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