X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FcheckLess.php;h=8416c8ab767936a32f22708b35182fc593d53c63;hb=41690888a2919b3fb89c715c364d21d8965c8b26;hp=f81285f0612fb99f29a2d12451208f1e54371f08;hpb=1360206275f5d9d141240356d3d9939b0ebcea89;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/checkLess.php b/maintenance/checkLess.php index f81285f061..8416c8ab76 100644 --- a/maintenance/checkLess.php +++ b/maintenance/checkLess.php @@ -22,7 +22,6 @@ */ require_once __DIR__ . '/Maintenance.php'; -require_once 'PHPUnit/Autoload.php'; /** * @ingroup Maintenance @@ -31,7 +30,8 @@ class CheckLess extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = 'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite'; + $this->addDescription( + 'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite' ); } public function execute() { @@ -40,13 +40,24 @@ class CheckLess extends Maintenance { // 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'; + self::requireTestsAutoloader(); + + // If phpunit isn't available by autoloader try pulling it in + if ( !class_exists( 'PHPUnit_Framework_TestCase' ) ) { + require_once 'PHPUnit/Autoload.php'; + } + + // RequestContext::resetMain() will print warnings unless this + // is defined. + if ( !defined( 'MW_PHPUNIT_TEST' ) ) { + define( 'MW_PHPUNIT_TEST', true ); + } $textUICommand = new PHPUnit_TextUI_Command(); - $argv = array( + $argv = [ "$IP/tests/phpunit/phpunit.php", "$IP/tests/phpunit/suites/LessTestSuite.php" - ); + ]; $textUICommand->run( $argv ); } }