Do not insert page titles into querycache.qc_value
[lhc/web/wiklou.git] / tests / phpunit / LessFileCompilationTest.php
1 <?php
2
3 /**
4 * Modelled on Sebastian Bergmann's PHPUnit_Extensions_PhptTestCase class.
5 *
6 * @see https://github.com/sebastianbergmann/phpunit/blob/master/src/Extensions/PhptTestCase.php
7 * @author Sam Smith <samsmith@wikimedia.org>
8 * @coversNothing
9 */
10 class LessFileCompilationTest extends ResourceLoaderTestCase {
11
12 /**
13 * @var string $file
14 */
15 protected $file;
16
17 /**
18 * @var ResourceLoaderModule The ResourceLoader module that contains
19 * the file
20 */
21 protected $module;
22
23 /**
24 * @param string $file
25 * @param ResourceLoaderModule $module The ResourceLoader module that
26 * contains the file
27 */
28 public function __construct( $file, ResourceLoaderModule $module ) {
29 parent::__construct( 'testLessFileCompilation' );
30
31 $this->file = $file;
32 $this->module = $module;
33 }
34
35 public function testLessFileCompilation() {
36 $thisString = $this->toString();
37 $this->assertTrue(
38 is_string( $this->file ) && is_file( $this->file ) && is_readable( $this->file ),
39 "$thisString must refer to a readable file"
40 );
41
42 $rlContext = $this->getResourceLoaderContext();
43
44 // Bleh
45 $method = new ReflectionMethod( $this->module, 'compileLessFile' );
46 $method->setAccessible( true );
47 $this->assertNotNull( $method->invoke( $this->module, $this->file, $rlContext ) );
48 }
49
50 public function toString() {
51 $moduleName = $this->module->getName();
52
53 return "{$this->file} in the \"{$moduleName}\" module";
54 }
55 }