Documentation

ApplicationTester
in package

Eases the testing of console applications.

When testing an application, don't forget to disable the auto exit flag:

$application = new Application(); $application->setAutoExit(false);

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Properties

$application  : mixed
$captureStreamsIndependently  : mixed
$input  : mixed
$output  : OutputInterface
$statusCode  : mixed

Methods

__construct()  : mixed
getDisplay()  : string
Gets the display returned by the last execution of the application.
getErrorOutput()  : string
Gets the output written to STDERR by the application.
getInput()  : InputInterface
Gets the input instance used by the last execution of the application.
getOutput()  : OutputInterface
Gets the output instance used by the last execution of the application.
getStatusCode()  : int
Gets the status code returned by the last execution of the application.
run()  : int
Executes the application.

Properties

$captureStreamsIndependently

private mixed $captureStreamsIndependently = false

Methods

getDisplay()

Gets the display returned by the last execution of the application.

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

getErrorOutput()

Gets the output written to STDERR by the application.

public getErrorOutput([bool $normalize = false ]) : string
Parameters
$normalize : bool = false

Whether to normalize end of lines to \n or not

Return values
string

getStatusCode()

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

public getStatusCode() : int
Return values
int

The status code

run()

Executes the application.

public run(array<string|int, mixed> $input[, array<string|int, mixed> $options = array() ]) : int

Available options:

  • interactive: Sets the input interactive flag
  • decorated: Sets the output decorated flag
  • verbosity: Sets the output verbosity flag
  • capture_stderr_separately: Make output of stdOut and stdErr separately available
Parameters
$input : array<string|int, mixed>

An array of arguments and options

$options : array<string|int, mixed> = array()

An array of options

Return values
int

The command exit code


        
On this page

Search results