class ApplicationTester

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);

Methods

__construct(Application $application)

No description

int
run(array $input, array $options = array())

Executes the application.

string
getDisplay(bool $normalize = false)

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

getInput()

Gets the input instance used by the last execution of the application.

getOutput()

Gets the output instance used by the last execution of the application.

int
getStatusCode()

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

Details

at line line 37
__construct(Application $application)

Parameters

Application $application

at line line 56
int run(array $input, array $options = array())

Executes the application.

Available options:

  • interactive: Sets the input interactive flag
  • decorated: Sets the output decorated flag
  • verbosity: Sets the output verbosity flag

Parameters

array $input An array of arguments and options
array $options An array of options

Return Value

int The command exit code

at line line 81
string getDisplay(bool $normalize = false)

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

Parameters

bool $normalize Whether to normalize end of lines to \n or not

Return Value

string The display

at line line 99
InputInterface getInput()

Gets the input instance used by the last execution of the application.

Return Value

InputInterface The current input instance

at line line 109
OutputInterface getOutput()

Gets the output instance used by the last execution of the application.

Return Value

OutputInterface The current output instance

at line line 119
int getStatusCode()

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

Return Value

int The status code