MediaWiki  REL1_24
LessFileCompilationTest.php
Go to the documentation of this file.
00001 <?php
00002 
00009 class LessFileCompilationTest extends ResourceLoaderTestCase {
00010 
00014     protected $file;
00015 
00020     protected $module;
00021 
00027     public function __construct( $file, ResourceLoaderModule $module ) {
00028         parent::__construct( 'testLessFileCompilation' );
00029 
00030         $this->file = $file;
00031         $this->module = $module;
00032     }
00033 
00034     public function testLessFileCompilation() {
00035         $thisString = $this->toString();
00036         $this->assertTrue(
00037             is_string( $this->file ) && is_file( $this->file ) && is_readable( $this->file ),
00038             "$thisString must refer to a readable file"
00039         );
00040 
00041         $rlContext = static::getResourceLoaderContext();
00042 
00043         // Bleh
00044         $method = new ReflectionMethod( $this->module, 'getLessCompiler' );
00045         $method->setAccessible( true );
00046         $compiler = $method->invoke( $this->module, $rlContext );
00047 
00048         $this->assertNotNull( $compiler->compileFile( $this->file ) );
00049     }
00050 
00051     public function getName( $withDataSet = true ) {
00052         return $this->toString();
00053     }
00054 
00055     public function toString() {
00056         $moduleName = $this->module->getName();
00057 
00058         return "{$this->file} in the \"{$moduleName}\" module";
00059     }
00060 }