Add the LessFileCompilationTest test case class, which represents the validation of a LESS file by compilation. Add the LessTestSuite test suite, which tests all LESS files registered with the ResourceLoader, and use this to rewrite the checkLess.php maintenance script. Bug: 54665 Change-Id: Iedb8dc31e4817d8b4e40b655cf9b8fb092979e90
34 lines
840 B
PHP
34 lines
840 B
PHP
<?php
|
|
|
|
/**
|
|
* @author Sam Smith <samsmith@wikimedia.org>
|
|
*/
|
|
class LessTestSuite extends PHPUnit_Framework_TestSuite {
|
|
public function __construct() {
|
|
parent::__construct();
|
|
|
|
$resourceLoader = new ResourceLoader();
|
|
|
|
foreach ( $resourceLoader->getModuleNames() as $name ) {
|
|
$module = $resourceLoader->getModule( $name );
|
|
if ( !$module || !$module instanceof ResourceLoaderFileModule ) {
|
|
continue;
|
|
}
|
|
|
|
foreach ( $module->getAllStyleFiles() as $styleFile ) {
|
|
// TODO (phuedx, 2014-03-19) The
|
|
// ResourceLoaderFileModule class shouldn't
|
|
// know how to get a file's extension.
|
|
if ( $module->getStyleSheetLang( $styleFile ) !== 'less' ) {
|
|
continue;
|
|
}
|
|
|
|
$this->addTest( new LessFileCompilationTest( $styleFile, $module ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
public static function suite() {
|
|
return new static;
|
|
}
|
|
}
|