blob: 71e0f4b2c696ef1f0fbd6dae6b1e6483c1d98362 (
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
57
58
59
60
|
<?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 = static::getResourceLoaderContext();
// Bleh
$method = new ReflectionMethod( $this->module, 'getLessCompiler' );
$method->setAccessible( true );
$compiler = $method->invoke( $this->module, $rlContext );
$this->assertNotNull( $compiler->compileFile( $this->file ) );
}
public function getName( $withDataSet = true ) {
return $this->toString();
}
public function toString() {
$moduleName = $this->module->getName();
return "{$this->file} in the \"{$moduleName}\" module";
}
}
|