A TestRunner for the Command Line Interface (CLI) PHP SAPI Module.
|
| run (array $argv, bool $exit=true) |
|
|
static | main (bool $exit=true) |
|
◆ createRunner()
PHPUnit\TextUI\Command::createRunner |
( |
| ) |
|
|
protected |
◆ handleArguments()
PHPUnit\TextUI\Command::handleArguments |
( |
array |
$argv | ) |
|
|
protected |
Handles the command-line arguments.
A child class of PHPUnit\TextUI\Command can hook into the argument parsing by adding the switch(es) to the $longOptions array and point to a callback method that handles the switch(es) in the child class like this
<?php class MyCommand extends PHPUnit\TextUI\Command { public function __construct() { // my-switch won't accept a value, it's an on/off $this->longOptions['my-switch'] = 'myHandler'; // my-secondswitch will accept a value - note the equals sign $this->longOptions['my-secondswitch='] = 'myOtherHandler'; }
// –my-switch -> myHandler() protected function myHandler() { }
// –my-secondswitch foo -> myOtherHandler('foo') protected function myOtherHandler ($value) { }
// You will also need this - the static keyword in the // PHPUnit\TextUI\Command will mean that it'll be // PHPUnit\TextUI\Command that gets instantiated, // not MyCommand public static function main($exit = true) { $command = new static;
return $command->run($_SERVER['argv'], $exit); }
}
- Exceptions
-
◆ handleBootstrap()
PHPUnit\TextUI\Command::handleBootstrap |
( |
string |
$filename | ) |
|
|
protected |
◆ handleCustomTestSuite()
PHPUnit\TextUI\Command::handleCustomTestSuite |
( |
| ) |
|
|
protected |
Custom callback for test suite discovery.
◆ handleLoader()
PHPUnit\TextUI\Command::handleLoader |
( |
string |
$loaderClass, |
|
|
string |
$loaderFile = '' |
|
) |
| |
|
protected |
Handles the loading of the PHPUnit\Runner\TestSuiteLoader implementation.
◆ handlePrinter()
PHPUnit\TextUI\Command::handlePrinter |
( |
string |
$printerClass, |
|
|
string |
$printerFile = '' |
|
) |
| |
|
protected |
Handles the loading of the PHPUnit\Util\Printer implementation.
- Returns
- null|Printer|string
◆ handleVersionCheck()
PHPUnit\TextUI\Command::handleVersionCheck |
( |
| ) |
|
|
protected |
◆ main()
static PHPUnit\TextUI\Command::main |
( |
bool |
$exit = true | ) |
|
|
static |
◆ run()
PHPUnit\TextUI\Command::run |
( |
array |
$argv, |
|
|
bool |
$exit = true |
|
) |
| |
◆ showHelp()
PHPUnit\TextUI\Command::showHelp |
( |
| ) |
|
|
protected |
◆ $arguments
PHPUnit\TextUI\Command::$arguments |
|
protected |
Initial value:= [
'listGroups' => false,
'listSuites' => false,
'listTests' => false,
'listTestsXml' => false,
'loader' => null,
'useDefaultConfiguration' => true,
'loadedExtensions' => [],
'notLoadedExtensions' => [],
]
◆ $longOptions
PHPUnit\TextUI\Command::$longOptions |
|
protected |
◆ $options
PHPUnit\TextUI\Command::$options = [] |
|
protected |
The documentation for this class was generated from the following file: