diff options
author | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
---|---|---|
committer | Yaco <franco@reevo.org> | 2020-06-04 11:01:00 -0300 |
commit | fc7369835258467bf97eb64f184b93691f9a9fd5 (patch) | |
tree | daabd60089d2dd76d9f5fb416b005fbe159c799d /www/wiki/tests/phpunit/LessFileCompilationTest.php |
first commit
Diffstat (limited to 'www/wiki/tests/phpunit/LessFileCompilationTest.php')
-rw-r--r-- | www/wiki/tests/phpunit/LessFileCompilationTest.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/www/wiki/tests/phpunit/LessFileCompilationTest.php b/www/wiki/tests/phpunit/LessFileCompilationTest.php new file mode 100644 index 00000000..5e1f1a96 --- /dev/null +++ b/www/wiki/tests/phpunit/LessFileCompilationTest.php @@ -0,0 +1,54 @@ +<?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, 'compileLessFile' ); + $method->setAccessible( true ); + $this->assertNotNull( $method->invoke( $this->module, $this->file, $rlContext ) ); + } + + public function toString() { + $moduleName = $this->module->getName(); + + return "{$this->file} in the \"{$moduleName}\" module"; + } +} |