MediaWiki  1.33.1
MediaWikiPHPUnitCommand.php
Go to the documentation of this file.
1 <?php
2 
3 class MediaWikiPHPUnitCommand extends PHPUnit_TextUI_Command {
4  private $cliArgs;
5 
6  public function __construct( $ignorableOptions, $cliArgs ) {
7  $ignore = function ( $arg ) {
8  };
9  foreach ( $ignorableOptions as $option ) {
10  $this->longOptions[$option] = $ignore;
11  }
12  $this->cliArgs = $cliArgs;
13  }
14 
15  protected function handleCustomTestSuite() {
16  // Use our suite.xml
17  if ( !isset( $this->arguments['configuration'] ) ) {
18  $this->arguments['configuration'] = __DIR__ . '/suite.xml';
19  }
20 
21  // Add our own listeners
22  $this->arguments['listeners'][] = new MediaWikiPHPUnitTestListener;
23  $this->arguments['listeners'][] = new MediaWikiLoggerPHPUnitTestListener;
24 
25  // Output only to stderr to avoid "Headers already sent" problems
26  $this->arguments['stderr'] = true;
27 
28  // Use a custom result printer that includes per-test logging output
29  // when nothing is provided.
30  if ( !isset( $this->arguments['printer'] ) ) {
31  $this->arguments['printer'] = MediaWikiPHPUnitResultPrinter::class;
32  }
33  }
34 
35  protected function createRunner() {
36  $runner = new MediaWikiTestRunner;
37  $runner->setMwCliArgs( $this->cliArgs );
38  return $runner;
39  }
40 }
MediaWikiPHPUnitCommand\__construct
__construct( $ignorableOptions, $cliArgs)
Definition: MediaWikiPHPUnitCommand.php:6
MediaWikiPHPUnitCommand\$cliArgs
$cliArgs
Definition: MediaWikiPHPUnitCommand.php:4
php
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:35
MediaWikiTestRunner
Definition: MediaWikiTestRunner.php:3
MediaWikiPHPUnitTestListener
Definition: MediaWikiPHPUnitTestListener.php:3
MediaWikiPHPUnitCommand\handleCustomTestSuite
handleCustomTestSuite()
Definition: MediaWikiPHPUnitCommand.php:15
MediaWikiTestRunner\setMwCliArgs
setMwCliArgs(array $cliArgs)
Definition: MediaWikiTestRunner.php:6
MediaWikiPHPUnitCommand
Definition: MediaWikiPHPUnitCommand.php:3
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
class
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:52
MediaWikiLoggerPHPUnitTestListener
Replaces the logging SPI on each test run.
Definition: MediaWikiLoggerPHPUnitTestListener.php:12
MediaWikiPHPUnitCommand\createRunner
createRunner()
Definition: MediaWikiPHPUnitCommand.php:35