Documentation

CommandTester
in package

Eases the testing of console commands.

Tags
author

Fabien Potencier fabien@symfony.com

author

Robin Chalas robin.chalas@gmail.com

Table of Contents

$command  : mixed
$input  : mixed
$inputs  : mixed
$output  : mixed
$statusCode  : mixed
__construct()  : mixed
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

Methods

execute()

Executes the command.

public execute(array<string|int, mixed> $input[, array<string|int, mixed> $options = [] ]) : 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> = []

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

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>

An array of strings representing each input passed to the command input stream

Return values
CommandTester —

createStream()

private static createStream(array<string|int, mixed> $inputs) : mixed
Parameters
$inputs : array<string|int, mixed>
Return values
mixed —

Search results