MediaWiki master
MediaWiki\Composer\ComposerLaunchParallel Class Reference

Launch PHPUnit test suites in parallel. More...

Inherits MediaWiki\Maintenance\ForkController.

Collaboration diagram for MediaWiki\Composer\ComposerLaunchParallel:

Public Member Functions

 __construct (string $phpUnitConfigFile, array $groups, array $excludeGroups, ?Event $event, ?SplitGroupExecutor $splitGroupExecutor=null, ?ComposerSystemInterface $composerSystemInterface=null)
 
 start ()
 Start the child processes.This should only be called from the command line. It should be called as early as possible during execution.This will return 'child' in the child processes. In the parent process, it will run until all the child processes exit or a TERM signal is received. It will then return 'done'.
Returns
string

 
- Public Member Functions inherited from MediaWiki\Maintenance\ForkController
 __construct ( $numProcs, $flags=0)
 
 allSuccessful ()
 Return true if all completed child processes exited with an exit status / return code of 0.
 
 getChildNumber ()
 Get the number of the child currently running.
 

Static Public Member Functions

static getDatabaseExcludeGroups ()
 
static getDatabaselessExcludeGroups ()
 
static getSplitGroupCount ()
 Get a split group count, either from the default defined on this class, or from PHPUNIT_PARALLEL_GROUP_COUNT in the environment.
 
static launchTests (Event $event, array $groups, array $excludeGroups)
 
static launchTestsCustomGroups (Event $event)
 
static launchTestsDatabase (Event $event)
 
static launchTestsDatabaseless (Event $event)
 

Public Attributes

const DATABASE_GROUPS = [ 'Database' ]
 
const DATABASELESS_GROUPS = []
 
const EXIT_STATUS_FAILURE = 1
 
const EXIT_STATUS_PHPUNIT_LIST_TESTS_ERROR = 2
 
const EXIT_STATUS_SUCCESS = 0
 

Protected Member Functions

 prepareEnvironment ()
 
- Protected Member Functions inherited from MediaWiki\Maintenance\ForkController
 forkWorkers ( $numProcs)
 Fork a number of worker processes.
 
 handleTermSignal (int $signal)
 
 initChild ()
 

Additional Inherited Members

- Protected Attributes inherited from MediaWiki\Maintenance\ForkController
int $childNumber = 0
 
array null $children = []
 
int[] $exitStatuses = []
 
int $flags = 0
 
int $procsToStart = 0
 
bool $termReceived = false
 
- Static Protected Attributes inherited from MediaWiki\Maintenance\ForkController
static int[] $RESTARTABLE_SIGNALS = []
 

Detailed Description

Launch PHPUnit test suites in parallel.

This class is run directly from composer.json, outside of any MediaWiki context; consequently, most MediaWiki code cannot be used here. We extend ForkController because it's convenient to do so and ForkController still works here, but we cannot use e.g. Shell::command() to run the composer sub-commands, nor anything else that requires MediaWiki services or config. (But we can use the underlying Shellbox library directly.)

Note
GPL-2.0-or-later

Definition at line 34 of file ComposerLaunchParallel.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Composer\ComposerLaunchParallel::__construct ( string $phpUnitConfigFile,
array $groups,
array $excludeGroups,
?Event $event,
?SplitGroupExecutor $splitGroupExecutor = null,
?ComposerSystemInterface $composerSystemInterface = null )

Member Function Documentation

◆ getDatabaseExcludeGroups()

static MediaWiki\Composer\ComposerLaunchParallel::getDatabaseExcludeGroups ( )
static

◆ getDatabaselessExcludeGroups()

static MediaWiki\Composer\ComposerLaunchParallel::getDatabaselessExcludeGroups ( )
static

◆ getSplitGroupCount()

static MediaWiki\Composer\ComposerLaunchParallel::getSplitGroupCount ( )
static

Get a split group count, either from the default defined on this class, or from PHPUNIT_PARALLEL_GROUP_COUNT in the environment.

Throws InvalidSplitGroupCountException for an invalid count.

Definition at line 239 of file ComposerLaunchParallel.php.

Referenced by MediaWiki\Composer\ComposerLaunchParallel\__construct().

◆ launchTests()

static MediaWiki\Composer\ComposerLaunchParallel::launchTests ( Event $event,
array $groups,
array $excludeGroups )
static
Exceptions
PhpUnitConsoleOutputProcessingException

Definition at line 165 of file ComposerLaunchParallel.php.

◆ launchTestsCustomGroups()

static MediaWiki\Composer\ComposerLaunchParallel::launchTestsCustomGroups ( Event $event)
static

Definition at line 194 of file ComposerLaunchParallel.php.

◆ launchTestsDatabase()

static MediaWiki\Composer\ComposerLaunchParallel::launchTestsDatabase ( Event $event)
static

Definition at line 213 of file ComposerLaunchParallel.php.

◆ launchTestsDatabaseless()

static MediaWiki\Composer\ComposerLaunchParallel::launchTestsDatabaseless ( Event $event)
static

Definition at line 225 of file ComposerLaunchParallel.php.

◆ prepareEnvironment()

MediaWiki\Composer\ComposerLaunchParallel::prepareEnvironment ( )
protected

Reimplemented from MediaWiki\Maintenance\ForkController.

Definition at line 106 of file ComposerLaunchParallel.php.

◆ start()

MediaWiki\Composer\ComposerLaunchParallel::start ( )

Start the child processes.This should only be called from the command line. It should be called as early as possible during execution.This will return 'child' in the child processes. In the parent process, it will run until all the child processes exit or a TERM signal is received. It will then return 'done'.

Returns
string

Reimplemented from MediaWiki\Maintenance\ForkController.

Definition at line 98 of file ComposerLaunchParallel.php.

Member Data Documentation

◆ DATABASE_GROUPS

const MediaWiki\Composer\ComposerLaunchParallel::DATABASE_GROUPS = [ 'Database' ]

◆ DATABASELESS_GROUPS

const MediaWiki\Composer\ComposerLaunchParallel::DATABASELESS_GROUPS = []

◆ EXIT_STATUS_FAILURE

const MediaWiki\Composer\ComposerLaunchParallel::EXIT_STATUS_FAILURE = 1

Definition at line 48 of file ComposerLaunchParallel.php.

◆ EXIT_STATUS_PHPUNIT_LIST_TESTS_ERROR

const MediaWiki\Composer\ComposerLaunchParallel::EXIT_STATUS_PHPUNIT_LIST_TESTS_ERROR = 2

Definition at line 49 of file ComposerLaunchParallel.php.

◆ EXIT_STATUS_SUCCESS

const MediaWiki\Composer\ComposerLaunchParallel::EXIT_STATUS_SUCCESS = 0

Definition at line 47 of file ComposerLaunchParallel.php.


The documentation for this class was generated from the following file: