wiki.techinc.nl/tests/phpunit/LessFileCompilationTest.php
Umherirrender d28f315d24 Add @coversNothing for left over tests and enable sniff
LessFileCompilationTest is checking less files for valid syntax
doc test is checking xml file for valid syntax
MediaWikiTest is testing a complex situation with many functions involved
SideBarTest is self checking, needs no coverage
structure tests not covers functions, there are covers global structures

Change-Id: I3ac65db561cae0be8418aa9c830e7a9f46ad11fe
2019-02-02 21:53:40 -08:00

55 lines
1.4 KiB
PHP

<?php
/**
* Modelled on Sebastian Bergmann's PHPUnit_Extensions_PhptTestCase class.
*
* @see https://github.com/sebastianbergmann/phpunit/blob/master/src/Extensions/PhptTestCase.php
* @author Sam Smith <samsmith@wikimedia.org>
* @coversNothing
*/
class LessFileCompilationTest extends ResourceLoaderTestCase {
/**
* @var string $file
*/
protected $file;
/**
* @var ResourceLoaderModule The ResourceLoader module that contains
* the file
*/
protected $module;
/**
* @param string $file
* @param ResourceLoaderModule $module The ResourceLoader module that
* contains the file
*/
public function __construct( $file, ResourceLoaderModule $module ) {
parent::__construct( 'testLessFileCompilation' );
$this->file = $file;
$this->module = $module;
}
public function testLessFileCompilation() {
$thisString = $this->toString();
$this->assertTrue(
is_string( $this->file ) && is_file( $this->file ) && is_readable( $this->file ),
"$thisString must refer to a readable file"
);
$rlContext = $this->getResourceLoaderContext();
// Bleh
$method = new ReflectionMethod( $this->module, 'compileLessFile' );
$method->setAccessible( true );
$this->assertNotNull( $method->invoke( $this->module, $this->file, $rlContext ) );
}
public function toString() {
$moduleName = $this->module->getName();
return "{$this->file} in the \"{$moduleName}\" module";
}
}