diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-05-01 15:12:12 -0400 |
commit | c9aa36da061816dee256a979c2ff8d2ee41824d9 (patch) | |
tree | 29f7002b80ee984b488bd047dbbd80b36bf892e9 /maintenance/checkLess.php | |
parent | b4274e0e33eafb5e9ead9d949ebf031a9fb8363b (diff) | |
parent | d1ba966140d7a60cd5ae4e8667ceb27c1a138592 (diff) |
Merge branch 'archwiki'
# Conflicts:
# skins/ArchLinux.php
# skins/ArchLinux/archlogo.gif
Diffstat (limited to 'maintenance/checkLess.php')
-rw-r--r-- | maintenance/checkLess.php | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/maintenance/checkLess.php b/maintenance/checkLess.php index d02d8a7b..b97e1b0b 100644 --- a/maintenance/checkLess.php +++ b/maintenance/checkLess.php @@ -22,49 +22,33 @@ */ require_once __DIR__ . '/Maintenance.php'; +require_once 'PHPUnit/Autoload.php'; /** * @ingroup Maintenance */ class CheckLess extends Maintenance { + public function __construct() { parent::__construct(); - $this->mDescription = 'Checks LESS files for errors'; + $this->mDescription = + 'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite'; } public function execute() { - $result = false; - $resourceLoader = new ResourceLoader(); - foreach ( $resourceLoader->getModuleNames() as $name ) { - /** @var ResourceLoaderFileModule $module */ - $module = $resourceLoader->getModule( $name ); - if ( !$module || !$module instanceof ResourceLoaderFileModule ) { - continue; - } + global $IP; + + // NOTE (phuedx, 2014-03-26) wgAutoloadClasses isn't set up + // by either of the dependencies at the top of the file, so + // require it here. + require_once __DIR__ . '/../tests/TestsAutoLoader.php'; - $hadErrors = false; - foreach ( $module->getAllStyleFiles() as $file ) { - if ( $module->getStyleSheetLang( $file ) !== 'less' ) { - continue; - } - try { - $compiler = ResourceLoader::getLessCompiler(); - $compiler->compileFile( $file ); - } catch ( Exception $e ) { - if ( !$hadErrors ) { - $this->error( "Errors checking module $name:\n" ); - $hadErrors = true; - } - $this->error( $e->getMessage() . "\n" ); - $result = true; - } - } - } - if ( !$result ) { - $this->output( "No errors found\n" ); - } else { - die( 1 ); - } + $textUICommand = new PHPUnit_TextUI_Command(); + $argv = array( + "$IP/tests/phpunit/phpunit.php", + "$IP/tests/phpunit/suites/LessTestSuite.php" + ); + $textUICommand->run( $argv ); } } |