Class Symfony\Component\Console\Tester\ApplicationTester

InheritanceSymfony\Component\Console\Tester\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);

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Symfony\Component\Console\Tester\ApplicationTester
getDisplay() Gets the display returned by the last execution of the application. Symfony\Component\Console\Tester\ApplicationTester
getErrorOutput() Gets the output written to STDERR by the application. Symfony\Component\Console\Tester\ApplicationTester
getInput() Gets the input instance used by the last execution of the application. Symfony\Component\Console\Tester\ApplicationTester
getOutput() Gets the output instance used by the last execution of the application. Symfony\Component\Console\Tester\ApplicationTester
getStatusCode() Gets the status code returned by the last execution of the application. Symfony\Component\Console\Tester\ApplicationTester
run() Executes the application. Symfony\Component\Console\Tester\ApplicationTester

Method Details

__construct() public method

public void __construct ( Symfony\Component\Console\Application $application )
$application
getDisplay() public method

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

public string getDisplay ( $normalize false )
$normalize bool

Whether to normalize end of lines to \n or not

return string

The display

getErrorOutput() public method

Gets the output written to STDERR by the application.

public string getErrorOutput ( $normalize false )
$normalize bool

Whether to normalize end of lines to \n or not

getInput() public method

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

public Symfony\Component\Console\Input\InputInterface getInput ( )
return Symfony\Component\Console\Input\InputInterface

The current input instance

getOutput() public method

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

public Symfony\Component\Console\Output\OutputInterface getOutput ( )
return Symfony\Component\Console\Output\OutputInterface

The current output instance

getStatusCode() public method

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

public int getStatusCode ( )
return int

The status code

run() public method

Executes the application.

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

An array of arguments and options

$options array

An array of options

return int

The command exit code