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

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

Methods

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

getStatusCode()

Gets the status code returned by the last execution of the application.

public getStatusCode() : int
Return values
int

The status code

createStream()

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

        
On this page

Search results