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

CloneableInstantiable
Methods
public static main(bool $exit = true) : int
 


  • throws PHPUnit\Framework\Exception
public run(array $argv, bool $exit = true) : int
Properties
protected $arguments
 


  • var array
protected $longOptions
 


  • var array
protected $options
 


  • var array
Methods
protected createRunner() : PHPUnit\TextUI\TestRunner
 
Create a TestRunner, override in subclasses.

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

}

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

protected handleCustomTestSuite() : void
 
Custom callback for test suite discovery.

protected handleLoader(string $loaderClass, string $loaderFile = '') : PHPUnit\Runner\TestSuiteLoader
 
Handles the loading of the PHPUnit\Runner\TestSuiteLoader implementation.

protected handlePrinter(string $printerClass, string $printerFile = '')
 
Handles the loading of the PHPUnit\Util\Printer implementation.

  • return null|\Printer|string
protected handleVersionCheck() : void
protected showHelp() : void
 
Show the help message.

Properties
private $versionStringPrinted
 


  • var bool
Methods
private exitWithErrorMessage(string $message) : void
private handleExtensions(string $directory) : void
private handleListGroups(PHPUnit\Framework\TestSuite $suite, bool $exit) : int
private handleListSuites(bool $exit) : int
 


  • throws PHPUnit\Framework\Exception
private handleListTests(PHPUnit\Framework\TestSuite $suite, bool $exit) : int
 


  • throws SebastianBergmann\RecursionContext\InvalidArgumentException
private handleListTestsXml(PHPUnit\Framework\TestSuite $suite, string $target, bool $exit) : int
 


  • throws SebastianBergmann\RecursionContext\InvalidArgumentException
private handleOrderByOption(string $value) : void
private printVersionString() : void
Methods
public static main(bool $exit = true) : int
 


  • throws PHPUnit\Framework\Exception
© 2020 Bruce Wells
Search Namespaces \ Classes
ConfigurationNumbers (0-9.) only