Documentation

PHPUnit_TextUI_Command
in package

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

Tags
since

Class available since Release 3.0.0

Table of Contents

$arguments  : array<string|int, mixed>
$longOptions  : array<string|int, mixed>
$options  : array<string|int, mixed>
$versionStringPrinted  : bool
main()  : mixed
run()  : int
createRunner()  : PHPUnit_TextUI_TestRunner
Create a TestRunner, override in subclasses.
handleArguments()  : mixed
Handles the command-line arguments.
handleBootstrap()  : mixed
Loads a bootstrap file.
handleCustomTestSuite()  : mixed
Custom callback for test suite discovery.
handleLoader()  : PHPUnit_Runner_TestSuiteLoader
Handles the loading of the PHPUnit_Runner_TestSuiteLoader implementation.
handlePrinter()  : PHPUnit_Util_Printer|string
Handles the loading of the PHPUnit_Util_Printer implementation.
handleSelfUpdate()  : mixed
handleVersionCheck()  : mixed
showHelp()  : mixed
Show the help message.
printVersionString()  : mixed
showError()  : mixed

Properties

$arguments

protected array<string|int, mixed> $arguments = array('listGroups' => alse, 'loader' => ull, 'useDefaultConfiguration' => rue)

$longOptions

protected array<string|int, mixed> $longOptions = array('colors==' => ull, 'bootstrap=' => ull, 'columns=' => ull, 'configuration=' => ull, 'coverage-clover=' => ull, 'coverage-crap4j=' => ull, 'coverage-html=' => ull, 'coverage-php=' => ull, 'coverage-text==' => ull, 'coverage-xml=' => ull, 'debug' => ull, 'exclude-group=' => ull, 'filter=' => ull, 'testsuite=' => ull, 'group=' => ull, 'help' => ull, 'include-path=' => ull, 'list-groups' => ull, 'loader=' => ull, 'log-json=' => ull, 'log-junit=' => ull, 'log-tap=' => ull, 'process-isolation' => ull, 'repeat=' => ull, 'stderr' => ull, 'stop-on-error' => ull, 'stop-on-failure' => ull, 'stop-on-incomplete' => ull, 'stop-on-risky' => ull, 'stop-on-skipped' => ull, 'report-useless-tests' => ull, 'strict-coverage' => ull, 'disallow-test-output' => ull, 'enforce-time-limit' => ull, 'disallow-todo-tests' => ull, 'strict-global-state' => ull, 'strict' => ull, 'tap' => ull, 'testdox' => ull, 'testdox-html=' => ull, 'testdox-text=' => ull, 'test-suffix=' => ull, 'no-configuration' => ull, 'no-coverage' => ull, 'no-globals-backup' => ull, 'printer=' => ull, 'static-backup' => ull, 'verbose' => ull, 'version' => ull)

$options

protected array<string|int, mixed> $options = array()

$versionStringPrinted

private bool $versionStringPrinted = alse

Methods

main()

public static main([bool $exit = true ]) : mixed
Parameters
$exit : bool = true
Return values
mixed

run()

public run(array<string|int, mixed> $argv[, bool $exit = true ]) : int
Parameters
$argv : array<string|int, mixed>
$exit : bool = true
Return values
int

handleArguments()

Handles the command-line arguments.

protected handleArguments(array<string|int, mixed> $argv) : mixed

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
$argv : array<string|int, mixed>
Return values
mixed

handleBootstrap()

Loads a bootstrap file.

protected handleBootstrap(string $filename) : mixed
Parameters
$filename : string
Return values
mixed

handleCustomTestSuite()

Custom callback for test suite discovery.

protected handleCustomTestSuite() : mixed
Return values
mixed

handlePrinter()

Handles the loading of the PHPUnit_Util_Printer implementation.

protected handlePrinter(string $printerClass[, string $printerFile = '' ]) : PHPUnit_Util_Printer|string
Parameters
$printerClass : string
$printerFile : string = ''
Return values
PHPUnit_Util_Printer|string

handleSelfUpdate()

protected handleSelfUpdate([mixed $upgrade = false ]) : mixed
Parameters
$upgrade : mixed = false
Tags
since

Method available since Release 4.0.0

Return values
mixed

handleVersionCheck()

protected handleVersionCheck() : mixed
Tags
since

Method available since Release 4.8.0

Return values
mixed

showHelp()

Show the help message.

protected showHelp() : mixed
Return values
mixed

printVersionString()

private printVersionString() : mixed
Return values
mixed

showError()

private showError(mixed $message) : mixed
Parameters
$message : mixed
Return values
mixed

Search results