MediaWiki  REL1_31
Go to the documentation of this file.
1 <?php
24 require_once __DIR__ . '/Maintenance.php';
29 class CheckLess extends Maintenance {
31  public function __construct() {
32  parent::__construct();
33  $this->addDescription(
34  'Checks LESS files for errors by running the LessTestSuite PHPUnit test suite' );
35  }
37  public function execute() {
38  global $IP;
40  // NOTE (phuedx, 2014-03-26) wgAutoloadClasses isn't set up
41  // by either of the dependencies at the top of the file, so
42  // require it here.
45  // If phpunit isn't available by autoloader try pulling it in
46  if ( !class_exists( 'PHPUnit\\Framework\\TestCase' ) ) {
47  require_once 'PHPUnit/Autoload.php';
48  }
50  // RequestContext::resetMain() will print warnings unless this
51  // is defined.
52  if ( !defined( 'MW_PHPUNIT_TEST' ) ) {
53  define( 'MW_PHPUNIT_TEST', true );
54  }
56  $textUICommand = new PHPUnit_TextUI_Command();
57  $argv = [
58  "$IP/tests/phpunit/phpunit.php",
59  "$IP/tests/phpunit/suites/LessTestSuite.php"
60  ];
61  $textUICommand->run( $argv );
62  }
63 }
66 require_once RUN_MAINTENANCE_IF_MAIN;
Definition: checkLess.php:65
Default constructor.
Definition: checkLess.php:31
Do the actual work.
Definition: checkLess.php:37
addDescription( $text)
Set the description text.
Definition: Maintenance.php:291
Definition: maintenance.txt:50
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
Definition: maintenance.txt:39
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:37
Some old classes from PHPUnit 4 that MediaWiki (conditionally) references.
Definition: phpunit4.php:9
Definition: checkLess.php:29
global $argv
Definition: autoload.ide.php:24
when a variable name is used in a it is silently declared as a new masking the global
Definition: design.txt:95
static requireTestsAutoloader()
Call this to set up the autoloader to allow classes to be used from the tests directory.
Definition: Maintenance.php:1620
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
Definition: maintenance.txt:56
Definition: WebStart.php:52