A test case class intended to make integration tests of cake console commands easier.
$_err protected Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null$_exitCode protected integer|null$_in protected Cake\Console\ConsoleInput|PHPUnit_Framework_MockObject_MockObject|null$_out protected Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null$_useCommandRunner protected booleanstderr contains expected output stderr is empty stderr contains expected regexp stdout contains expected output stdout is empty stdout does not contain expected output stdout contains expected regexp Set this test case to use the CommandRunner rather than the legacy ShellDispatcher
assertErrorContains( string $expected , string $message = '' )
Asserts stderr contains expected output
$expected $message optional '' assertErrorEmpty( string $message = '' )
Asserts that stderr is empty
$message optional '' assertErrorRegExp( string $pattern , string $message = '' )
Asserts stderr contains expected regexp
$pattern $message optional '' assertExitCode( integer $expected , string $message = '' )
Asserts shell exited with the expected code
$expected $message optional '' assertExitError( string $message = '' )
Asserts shell exited with Command::CODE_ERROR
$message optional '' assertExitSuccess( string $message = '' )
Asserts shell exited with the Command::CODE_SUCCESS
$message optional '' assertOutputContains( string $expected , string $message = '' )
Asserts stdout contains expected output
$expected $message optional '' assertOutputContainsRow( array $row , string $message = '' )
Check that a row of cells exists in the output.
$row $message optional '' assertOutputEmpty( string $message = '' )
Asserts that stdout is empty
$message optional '' assertOutputNotContains( string $expected , string $message = '' )
Asserts stdout does not contain expected output
$expected $message optional '' assertOutputRegExp( string $pattern , string $message = '' )
Asserts stdout contains expected regexp
$pattern $message optional '' cleanupConsoleTrait( )
Cleans state to get ready for the next test
commandStringToArgs( string $command )
Creates an $argv array from a command string
$command exec( string $command , array $input = [] )
Runs cli integration test
$command $input optional [] makeRunner( )
Builds the appropriate command dispatcher
Cake\Console\CommandRunner|Cake\TestSuite\LegacyCommandRunneruseCommandRunner( )
Set this test case to use the CommandRunner rather than the legacy ShellDispatcher
protected Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null
Console error output stub
protected Cake\Console\ConsoleInput|PHPUnit_Framework_MockObject_MockObject|null
Console input mock
protected Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null
Console output stub
© 2005–present The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
https://api.cakephp.org/3.8/class-Cake.TestSuite.ConsoleIntegrationTestTrait.html