Merge "DatabaseMssql: Don't duplicate body of makeList()"
[mediawiki.git] / tests / phpunit / LessFileCompilationTest.php
blobdf4690a4f69d8b4f122eafc2293b260846d16134
1 <?php
3 /**
4 * Modelled on Sebastian Bergmann's PHPUnit_Extensions_PhptTestCase class.
6 * @see https://github.com/sebastianbergmann/phpunit/blob/master/src/Extensions/PhptTestCase.php
7 * @author Sam Smith <samsmith@wikimedia.org>
8 */
9 class LessFileCompilationTest extends ResourceLoaderTestCase {
11 /**
12 * @var string $file
14 protected $file;
16 /**
17 * @var ResourceLoaderModule The ResourceLoader module that contains
18 * the file
20 protected $module;
22 /**
23 * @param string $file
24 * @param ResourceLoaderModule $module The ResourceLoader module that
25 * contains the file
27 public function __construct( $file, ResourceLoaderModule $module ) {
28 parent::__construct( 'testLessFileCompilation' );
30 $this->file = $file;
31 $this->module = $module;
34 public function testLessFileCompilation() {
35 $thisString = $this->toString();
36 $this->assertTrue(
37 is_string( $this->file ) && is_file( $this->file ) && is_readable( $this->file ),
38 "$thisString must refer to a readable file"
41 $rlContext = $this->getResourceLoaderContext();
43 // Bleh
44 $method = new ReflectionMethod( $this->module, 'getLessCompiler' );
45 $method->setAccessible( true );
46 $compiler = $method->invoke( $this->module, $rlContext );
48 $this->assertNotNull( $compiler->compileFile( $this->file ) );
51 public function getName( $withDataSet = true ) {
52 return $this->toString();
55 public function toString() {
56 $moduleName = $this->module->getName();
58 return "{$this->file} in the \"{$moduleName}\" module";