PHP Class PHPUnit_TextUI_Command, phpunit

Author: Sebastian Bergmann ([email protected])
Mostrar archivo Open project: sebastianbergmann/phpunit Class Usage Examples

Protected Properties

Property Type Description
$arguments array
$longOptions array
$options array

Public Methods

Method Description
main ( boolean $exit = true )
run ( array $argv, boolean $exit = true ) : integer

Protected Methods

Method Description
createRunner ( ) : PHPUnit_TextUI_TestRunner Create a TestRunner, override in subclasses.
handleArguments ( array $argv ) Handles the command-line arguments.
handleBootstrap ( string $filename ) Loads a bootstrap file.
handleCustomTestSuite ( ) Custom callback for test suite discovery.
handleLoader ( string $loaderClass, string $loaderFile = '' ) : PHPUnit_Runner_TestSuiteLoader Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.
handlePrinter ( string $printerClass, string $printerFile = '' ) : PHPUnit_Util_Printer Handles the loading of the PHPUnit_Util_Printer implementation.
handleVersionCheck ( )
showHelp ( ) Show the help message.

Private Methods

Method Description
handleExtensions ( string $directory )
printVersionString ( )
showError ( $message )

Method Details

createRunner() protected method

Create a TestRunner, override in subclasses.
protected createRunner ( ) : PHPUnit_TextUI_TestRunner
return PHPUnit_TextUI_TestRunner

handleArguments() protected method

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 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); } }
protected handleArguments ( array $argv )
$argv array

handleBootstrap() protected method

Loads a bootstrap file.
protected handleBootstrap ( string $filename )
$filename string

handleCustomTestSuite() protected method

Custom callback for test suite discovery.
protected handleCustomTestSuite ( )

handleLoader() protected method

Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.
protected handleLoader ( string $loaderClass, string $loaderFile = '' ) : PHPUnit_Runner_TestSuiteLoader
$loaderClass string
$loaderFile string
return PHPUnit_Runner_TestSuiteLoader

handlePrinter() protected method

Handles the loading of the PHPUnit_Util_Printer implementation.
protected handlePrinter ( string $printerClass, string $printerFile = '' ) : PHPUnit_Util_Printer
$printerClass string
$printerFile string
return PHPUnit_Util_Printer

handleVersionCheck() protected method

protected handleVersionCheck ( )

main() public static method

public static main ( boolean $exit = true )
$exit boolean

run() public method

public run ( array $argv, boolean $exit = true ) : integer
$argv array
$exit boolean
return integer

showHelp() protected method

Show the help message.
protected showHelp ( )

Property Details

$arguments protected_oe property

protected array $arguments
return array

$longOptions protected_oe property

protected array $longOptions
return array

$options protected_oe property

protected array $options
return array