Command
in package
Tags
Table of Contents
Properties
- $arguments : array<string, mixed>
- $longOptions : array<string, mixed>
- $versionStringPrinted : bool
- $warnings : mixed
Methods
- main() : int
- run() : int
- createRunner() : TestRunner
- Create a TestRunner, override in subclasses.
- handleArguments() : void
- Handles the command-line arguments.
- handleBootstrap() : void
- Loads a bootstrap file.
- handleCustomTestSuite() : void
- Custom callback for test suite discovery.
- handleLoader() : TestSuiteLoader|null
- Handles the loading of the PHPUnit\Runner\TestSuiteLoader implementation.
- handlePrinter() : null|Printer|string
- Handles the loading of the PHPUnit\Util\Printer implementation.
- handleVersionCheck() : void
- showHelp() : void
- Show the help message.
- configurationFileInDirectory() : string|null
- exitWithErrorMessage() : void
- generateConfiguration() : void
- handleCustomOptions() : void
- handleListGroups() : int
- handleListSuites() : int
- handleListTests() : int
- handleListTestsXml() : int
- handleWarmCoverageCache() : void
- mapKeyToOptionForWarning() : string
- migrateConfiguration() : void
- printVersionString() : void
- warnAboutConflictingOptions() : void
Properties
$arguments
protected
array<string, mixed>
$arguments
= []
$longOptions
protected
array<string, mixed>
$longOptions
= []
$versionStringPrinted
private
bool
$versionStringPrinted
= false
$warnings
private
mixed
$warnings
= []
Tags
Methods
main()
public
static main([bool $exit = true ]) : int
Parameters
- $exit : bool = true
Tags
Return values
intrun()
public
run(array<string|int, mixed> $argv[, bool $exit = true ]) : int
Parameters
- $argv : array<string|int, mixed>
- $exit : bool = true
Tags
Return values
intcreateRunner()
Create a TestRunner, override in subclasses.
protected
createRunner() : TestRunner
Return values
TestRunnerhandleArguments()
Handles the command-line arguments.
protected
handleArguments(array<string|int, mixed> $argv) : void
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>
Tags
handleBootstrap()
Loads a bootstrap file.
protected
handleBootstrap(string $filename) : void
Parameters
- $filename : string
handleCustomTestSuite()
Custom callback for test suite discovery.
protected
handleCustomTestSuite() : void
handleLoader()
Handles the loading of the PHPUnit\Runner\TestSuiteLoader implementation.
protected
handleLoader(string $loaderClass[, string $loaderFile = '' ]) : TestSuiteLoader|null
see https://github.com/sebastianbergmann/phpunit/issues/4039
Parameters
- $loaderClass : string
- $loaderFile : string = ''
Return values
TestSuiteLoader|nullhandlePrinter()
Handles the loading of the PHPUnit\Util\Printer implementation.
protected
handlePrinter(string $printerClass[, string $printerFile = '' ]) : null|Printer|string
Parameters
- $printerClass : string
- $printerFile : string = ''
Return values
null|Printer|stringhandleVersionCheck()
protected
handleVersionCheck() : void
showHelp()
Show the help message.
protected
showHelp() : void
configurationFileInDirectory()
private
configurationFileInDirectory(string $directory) : string|null
Parameters
- $directory : string
Return values
string|nullexitWithErrorMessage()
private
exitWithErrorMessage(string $message) : void
Parameters
- $message : string
generateConfiguration()
private
generateConfiguration() : void
handleCustomOptions()
private
handleCustomOptions(array<string|int, mixed> $unrecognizedOptions) : void
Parameters
- $unrecognizedOptions : array<string|int, mixed>
handleListGroups()
private
handleListGroups(TestSuite $suite, bool $exit) : int
Parameters
- $suite : TestSuite
- $exit : bool
Return values
inthandleListSuites()
private
handleListSuites(bool $exit) : int
Parameters
- $exit : bool
Tags
Return values
inthandleListTests()
private
handleListTests(TestSuite $suite, bool $exit) : int
Parameters
- $suite : TestSuite
- $exit : bool
Tags
Return values
inthandleListTestsXml()
private
handleListTestsXml(TestSuite $suite, string $target, bool $exit) : int
Parameters
- $suite : TestSuite
- $target : string
- $exit : bool
Tags
Return values
inthandleWarmCoverageCache()
private
handleWarmCoverageCache(Configuration $configuration) : void
Parameters
- $configuration : Configuration
mapKeyToOptionForWarning()
private
mapKeyToOptionForWarning(string $key) : string
Parameters
- $key : string
Tags
Return values
stringmigrateConfiguration()
private
migrateConfiguration(string $filename) : void
Parameters
- $filename : string
printVersionString()
private
printVersionString() : void
warnAboutConflictingOptions()
private
warnAboutConflictingOptions(string $key, array<string|int, mixed> $keys) : void
Parameters
- $key : string
- $keys : array<string|int, mixed>