TYPO3  7.6
Public Member Functions | Private Attributes | List of all members
CommandTester Class Reference

Public Member Functions

 __construct (Command $command)
 
 execute (array $input, array $options=array())
 
 getDisplay ($normalize=false)
 
 getInput ()
 
 getOutput ()
 
 getStatusCode ()
 

Private Attributes

 $command
 
 $input
 
 $output
 
 $statusCode
 

Detailed Description

Eases the testing of console commands.

Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 25 of file CommandTester.php.

Constructor & Destructor Documentation

__construct ( Command  $command)

Constructor.

Parameters
Command$commandA Command instance to test.

Definition at line 37 of file CommandTester.php.

References CommandTester\$command.

Member Function Documentation

execute ( array  $input,
array  $options = array() 
)

Executes the command.

Available execution options:

  • interactive: Sets the input interactive flag
  • decorated: Sets the output decorated flag
  • verbosity: Sets the output verbosity flag
Parameters
array$inputAn array of command arguments and options
array$optionsAn array of execution options
Returns
int The command exit code

Definition at line 56 of file CommandTester.php.

Referenced by HelpCommandTest\testExecuteForApplicationCommand(), HelpCommandTest\testExecuteForApplicationCommandWithXmlOption(), ListCommandTest\testExecuteListsCommands(), ListCommandTest\testExecuteListsCommandsWithNamespaceArgument(), ListCommandTest\testExecuteListsCommandsWithRawOption(), and ListCommandTest\testExecuteListsCommandsWithXmlOption().

getDisplay (   $normalize = false)

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

Parameters
bool$normalizeWhether to normalize end of lines to
or not
Returns
string The display

Definition at line 90 of file CommandTester.php.

getInput ( )

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

Returns
InputInterface The current input instance

Definition at line 108 of file CommandTester.php.

References CommandTester\$input.

getOutput ( )

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

Returns
OutputInterface The current output instance

Definition at line 118 of file CommandTester.php.

References CommandTester\$output.

getStatusCode ( )

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

Returns
int The status code

Definition at line 128 of file CommandTester.php.

References CommandTester\$statusCode.

Member Data Documentation

$command
private

Definition at line 27 of file CommandTester.php.

Referenced by CommandTester\__construct().

$input
private

Definition at line 28 of file CommandTester.php.

Referenced by CommandTester\getInput().

$output
private

Definition at line 29 of file CommandTester.php.

Referenced by CommandTester\getOutput().

$statusCode
private

Definition at line 30 of file CommandTester.php.

Referenced by CommandTester\getStatusCode().