Class Symfony\Component\Console\Tester\CommandTester

InheritanceSymfony\Component\Console\Tester\CommandTester

Eases the testing of console commands.

Public Methods

Hide inherited methods

MethodDescriptionDefined By
__construct() Constructor. Symfony\Component\Console\Tester\CommandTester
execute() Executes the command. Symfony\Component\Console\Tester\CommandTester
getDisplay() Gets the display returned by the last execution of the command. Symfony\Component\Console\Tester\CommandTester
getInput() Gets the input instance used by the last execution of the command. Symfony\Component\Console\Tester\CommandTester
getOutput() Gets the output instance used by the last execution of the command. Symfony\Component\Console\Tester\CommandTester
getStatusCode() Gets the status code returned by the last execution of the application. Symfony\Component\Console\Tester\CommandTester

Method Details

__construct() public method

Constructor.

public void __construct ( Symfony\Component\Console\Command\Command $command )
$command Symfony\Component\Console\Command\Command

A Command instance to test

execute() public method

Executes the command.

Available execution options:

  • interactive: Sets the input interactive flag
  • decorated: Sets the output decorated flag
  • verbosity: Sets the output verbosity flag
public int execute ( array $input, array $options = [] )
$input array

An array of command arguments and options

$options array

An array of execution options

return int

The command exit code

getDisplay() public method

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

public string getDisplay ( $normalize false )
$normalize bool

Whether to normalize end of lines to \n or not

return string

The display

getInput() public method

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

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 command.

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