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>
9 class LessFileCompilationTest
extends ResourceLoaderTestCase
{
17 * @var ResourceLoaderModule The ResourceLoader module that contains
24 * @param ResourceLoaderModule $module The ResourceLoader module that
27 public function __construct( $file, ResourceLoaderModule
$module ) {
28 parent
::__construct( 'testLessFileCompilation' );
31 $this->module
= $module;
34 public function testLessFileCompilation() {
35 $thisString = $this->toString();
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();
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";