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

Public Member Functions

 __construct (Application $application)
 
 run (array $input, $options=array())
 
 getDisplay ($normalize=false)
 
 getInput ()
 
 getOutput ()
 
 getStatusCode ()
 

Private Attributes

 $application
 
 $input
 
 $output
 
 $statusCode
 

Detailed Description

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);
Author
Fabien Potencier fabie.nosp@m.n@sy.nosp@m.mfony.nosp@m..com

Definition at line 30 of file ApplicationTester.php.

Constructor & Destructor Documentation

__construct ( Application  $application)

Constructor.

Parameters
Application$applicationAn Application instance to test.

Definition at line 42 of file ApplicationTester.php.

References ApplicationTester\$application.

Member Function Documentation

getDisplay (   $normalize = false)

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

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

Definition at line 86 of file ApplicationTester.php.

getInput ( )

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

Returns
InputInterface The current input instance

Definition at line 104 of file ApplicationTester.php.

References ApplicationTester\$input.

getOutput ( )

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

Returns
OutputInterface The current output instance

Definition at line 114 of file ApplicationTester.php.

References ApplicationTester\$output.

getStatusCode ( )

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

Returns
int The status code

Definition at line 124 of file ApplicationTester.php.

References ApplicationTester\$statusCode.

run ( array  $input,
  $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$inputAn array of arguments and options
array$optionsAn array of options
Returns
int The command exit code

Definition at line 61 of file ApplicationTester.php.

Member Data Documentation

$application
private

Definition at line 32 of file ApplicationTester.php.

Referenced by ApplicationTester\__construct().

$input
private

Definition at line 33 of file ApplicationTester.php.

Referenced by ApplicationTester\getInput().

$output
private

Definition at line 34 of file ApplicationTester.php.

Referenced by ApplicationTester\getOutput().

$statusCode
private

Definition at line 35 of file ApplicationTester.php.

Referenced by ApplicationTester\getStatusCode().