2014-03-17 13:24:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
2019-02-16 23:16:09 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
2019-10-06 04:54:59 +00:00
|
|
|
use PHPUnit\Framework\TestSuite;
|
2019-02-16 23:16:09 +00:00
|
|
|
|
2014-03-17 13:24:52 +00:00
|
|
|
/**
|
|
|
|
|
* @author Sam Smith <samsmith@wikimedia.org>
|
|
|
|
|
*/
|
2019-10-06 04:54:59 +00:00
|
|
|
class LessTestSuite extends TestSuite {
|
2014-03-17 13:24:52 +00:00
|
|
|
public function __construct() {
|
|
|
|
|
parent::__construct();
|
|
|
|
|
|
2019-02-16 23:16:09 +00:00
|
|
|
$resourceLoader = MediaWikiServices::getInstance()->getResourceLoader();
|
2014-03-17 13:24:52 +00:00
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|