class (none) \ PHPUnit_TextUI_Command


A TestRunner for the Command Line Interface (CLI) PHP SAPI Module.


Method Summary

Name Description
createRunner()Create a TestRunner, override in subclasses.
handleArguments(array $argv)Handles the command-line arguments.
handleBootstrap($filename)Loads a bootstrap file.
handleCustomTestSuite()Custom callback for test suite discovery.
handleLoader($loaderClass, $loaderFile = "")Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.
handlePrinter($printerClass, $printerFile = "")Handles the loading of the PHPUnit_Util_Printer implementation.
handleSelfUpdate()
main($exit = true)
printVersionString()
run(array $argv, $exit = true)
showError($message)
showHelp()Show the help message.

protected function createRunner()

Create a TestRunner, override in subclasses.

Returns:
PHPUnit_TextUI_TestRunner

protected function 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

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); }

}

Parameters:
array - $argv

protected function handleBootstrap($filename)

Loads a bootstrap file.

Parameters:
string - $filename

protected function handleCustomTestSuite()

Custom callback for test suite discovery.


protected function handleLoader($loaderClass, $loaderFile = "")

Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.

Parameters:
string - $loaderFile
Defaults:
loaderFile = ""
Returns:
PHPUnit_Runner_TestSuiteLoader

protected function handlePrinter($printerClass, $printerFile = "")

Handles the loading of the PHPUnit_Util_Printer implementation.

Parameters:
string - $printerFile
Defaults:
printerFile = ""
Returns:
PHPUnit_Util_Printer

protected function handleSelfUpdate()


public static function main($exit = true)

Parameters:
boolean - $exit
Defaults:
exit = true

private function printVersionString()


public function run(array $argv, $exit = true)

Parameters:
array - $argv
boolean - $exit
Defaults:
exit = true
Returns:
integer

private function showError($message)


protected function showHelp()

Show the help message.