Merge "Update docs/hooks.txt for ShowSearchHitTitle"
[mediawiki.git] / tests / phpunit / LessFileCompilationTest.php
blob5e1f1a9666fb0847008efca7fc526d1a9259ae65
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, 'compileLessFile' );
45 $method->setAccessible( true );
46 $this->assertNotNull( $method->invoke( $this->module, $this->file, $rlContext ) );
49 public function toString() {
50 $moduleName = $this->module->getName();
52 return "{$this->file} in the \"{$moduleName}\" module";