CommandTester
in package
Eases the testing of console commands.
Tags
Table of Contents
Properties
- $command : mixed
- $input : mixed
- $inputs : mixed
- $output : mixed
- $statusCode : mixed
Methods
- __construct() : mixed
- Constructor.
- execute() : int
- Executes the command.
- getDisplay() : string
- Gets the display returned by the last execution of the command.
- getInput() : InputInterface
- Gets the input instance used by the last execution of the command.
- getOutput() : OutputInterface
- Gets the output instance used by the last execution of the command.
- getStatusCode() : int
- Gets the status code returned by the last execution of the application.
- setInputs() : CommandTester
- Sets the user inputs.
- createStream() : mixed
Properties
$command
private
mixed
$command
$input
private
mixed
$input
$inputs
private
mixed
$inputs
= array()
$output
private
mixed
$output
$statusCode
private
mixed
$statusCode
Methods
__construct()
Constructor.
public
__construct(Command $command) : mixed
Parameters
- $command : Command
-
A Command instance to test
execute()
Executes the command.
public
execute(array<string|int, mixed> $input[, array<string|int, mixed> $options = array() ]) : int
Available execution options:
- interactive: Sets the input interactive flag
- decorated: Sets the output decorated flag
- verbosity: Sets the output verbosity flag
Parameters
- $input : array<string|int, mixed>
-
An array of command arguments and options
- $options : array<string|int, mixed> = array()
-
An array of execution options
Return values
int —The command exit code
getDisplay()
Gets the display returned by the last execution of the command.
public
getDisplay([bool $normalize = false ]) : string
Parameters
- $normalize : bool = false
-
Whether to normalize end of lines to \n or not
Return values
string —The display
getInput()
Gets the input instance used by the last execution of the command.
public
getInput() : InputInterface
Return values
InputInterface —The current input instance
getOutput()
Gets the output instance used by the last execution of the command.
public
getOutput() : OutputInterface
Return values
OutputInterface —The current output instance
getStatusCode()
Gets the status code returned by the last execution of the application.
public
getStatusCode() : int
Return values
int —The status code
setInputs()
Sets the user inputs.
public
setInputs(array<string|int, mixed> $inputs) : CommandTester
Parameters
- $inputs : array<string|int, mixed>
Return values
CommandTestercreateStream()
private
static createStream(array<string|int, mixed> $inputs) : mixed
Parameters
- $inputs : array<string|int, mixed>