PHPUnit_TextUI_Command
class PHPUnit_TextUI_Command (View source)
A TestRunner for the Command Line Interface (CLI) PHP SAPI Module.
Properties
protected array | $arguments | ||
protected array | $options | ||
protected array | $longOptions |
Methods
No description
No description
Create a TestRunner, override in subclasses.
Handles the command-line arguments.
Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.
Handles the loading of the PHPUnit_Util_Printer implementation.
Loads a bootstrap file.
No description
No description
Show the help message.
Custom callback for test suite discovery.
Details
at line 112
static
main(bool $exit = true)
at line 125
int
run(array $argv, bool $exit = true)
at line 211
protected PHPUnit_TextUI_TestRunner
createRunner()
Create a TestRunner, override in subclasses.
at line 261
protected
handleArguments(array $argv)
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);
}
}
at line 821
protected PHPUnit_Runner_TestSuiteLoader
handleLoader(string $loaderClass, string $loaderFile = '')
Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.
at line 866
protected PHPUnit_Util_Printer|string
handlePrinter(string $printerClass, string $printerFile = '')
Handles the loading of the PHPUnit_Util_Printer implementation.
at line 911
protected
handleBootstrap(string $filename)
Loads a bootstrap file.
at line 920
protected
handleSelfUpdate($upgrade = false)
at line 1008
protected
handleVersionCheck()
at line 1028
protected
showHelp()
Show the help message.
at line 1132
protected
handleCustomTestSuite()
Custom callback for test suite discovery.