X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FcheckLess.php;h=eeec9d1c89467868fb25f69f921473a64eab8e8b;hb=1c80fe572eec7610f35c87e0a43e49d886193d58;hp=b97e1b0b23780c85339eda4428f94f1f95e2affe;hpb=f0edb3e368a5fc69218d20f76f1538b68f37db42;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/checkLess.php b/maintenance/checkLess.php index b97e1b0b23..eeec9d1c89 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,8 +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() { @@ -43,11 +42,22 @@ class CheckLess extends Maintenance { // require it here. require_once __DIR__ . '/../tests/TestsAutoLoader.php'; + // 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 ); } }