CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Team
    • Issues (Github)
    • YouTube Channel
    • Get Involved
    • Bakery
    • Featured Resources
    • Newsletter
    • Certification
    • My CakePHP
    • CakeFest
    • Facebook
    • Twitter
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 3.8 Red Velvet API

  • Overview
  • Tree
  • Deprecated
  • Version:
    • 3.8
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Cake
    • Auth
      • Storage
    • Cache
      • Engine
    • Collection
      • Iterator
    • Command
    • Console
      • Exception
    • Controller
      • Component
      • Exception
    • Core
      • Configure
        • Engine
      • Exception
      • Retry
    • Database
      • Driver
      • Exception
      • Expression
      • Schema
      • Statement
      • Type
    • Datasource
      • Exception
    • Error
      • Middleware
    • Event
      • Decorator
    • Filesystem
    • Form
    • Http
      • Client
        • Adapter
        • Auth
      • Cookie
      • Exception
      • Middleware
      • Session
    • I18n
      • Formatter
      • Middleware
      • Parser
    • Log
      • Engine
    • Mailer
      • Exception
      • Transport
    • Network
      • Exception
    • ORM
      • Association
      • Behavior
        • Translate
      • Exception
      • Locator
      • Rule
    • Routing
      • Exception
      • Filter
      • Middleware
      • Route
    • Shell
      • Helper
      • Task
    • TestSuite
      • Fixture
      • Stub
    • Utility
      • Exception
    • Validation
    • View
      • Exception
      • Form
      • Helper
      • Widget
  • None

Classes

  • ConsoleIntegrationTestCase
  • IntegrationTestCase
  • LegacyCommandRunner
  • LegacyShellDispatcher
  • TestCase
  • TestEmailTransport
  • TestSuite

Traits

  • ConsoleIntegrationTestTrait
  • EmailAssertTrait
  • EmailTrait
  • IntegrationTestTrait
  • StringCompareTrait

Trait ConsoleIntegrationTestTrait

A test case class intended to make integration tests of cake console commands easier.

Direct Users

  • Cake\TestSuite\ConsoleIntegrationTestCase
Namespace: Cake\TestSuite
Location: TestSuite/ConsoleIntegrationTestTrait.php

Properties summary

  • $_err protected
    Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null
    Console error output stub
  • $_exitCode protected
    integer|null
    Last exit code
  • $_in protected
    Cake\Console\ConsoleInput|PHPUnit_Framework_MockObject_MockObject|null
    Console input mock
  • $_out protected
    Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null
    Console output stub
  • $_useCommandRunner protected
    boolean
    Whether or not to use the CommandRunner

Method Summary

  • assertErrorContains() public
    Asserts stderr contains expected output
  • assertErrorEmpty() public
    Asserts that stderr is empty
  • assertErrorRegExp() public
    Asserts stderr contains expected regexp
  • assertExitCode() public
    Asserts shell exited with the expected code
  • assertExitError() public
    Asserts shell exited with Command::CODE_ERROR
  • assertExitSuccess() public
    Asserts shell exited with the Command::CODE_SUCCESS
  • assertOutputContains() public
    Asserts stdout contains expected output
  • assertOutputContainsRow() protected
    Check that a row of cells exists in the output.
  • assertOutputEmpty() public
    Asserts that stdout is empty
  • assertOutputNotContains() public
    Asserts stdout does not contain expected output
  • assertOutputRegExp() public
    Asserts stdout contains expected regexp
  • cleanupConsoleTrait() public
    Cleans state to get ready for the next test
  • commandStringToArgs() protected
    Creates an $argv array from a command string
  • exec() public
    Runs cli integration test
  • makeRunner() protected
    Builds the appropriate command dispatcher
  • useCommandRunner() public

    Set this test case to use the CommandRunner rather than the legacy ShellDispatcher

Method Detail

assertErrorContains() public ¶

assertErrorContains( string $expected , string $message = '' )

Asserts stderr contains expected output

Parameters
string $expected
Expected output
string $message optional ''
Failure message

assertErrorEmpty() public ¶

assertErrorEmpty( string $message = '' )

Asserts that stderr is empty

Parameters
string $message optional ''
The message to output when the assertion fails.

assertErrorRegExp() public ¶

assertErrorRegExp( string $pattern , string $message = '' )

Asserts stderr contains expected regexp

Parameters
string $pattern
Expected pattern
string $message optional ''
Failure message

assertExitCode() public ¶

assertExitCode( integer $expected , string $message = '' )

Asserts shell exited with the expected code

Parameters
integer $expected
Expected exit code
string $message optional ''
Failure message

assertExitError() public ¶

assertExitError( string $message = '' )

Asserts shell exited with Command::CODE_ERROR

Parameters
string $message optional ''
Failure message

assertExitSuccess() public ¶

assertExitSuccess( string $message = '' )

Asserts shell exited with the Command::CODE_SUCCESS

Parameters
string $message optional ''
Failure message

assertOutputContains() public ¶

assertOutputContains( string $expected , string $message = '' )

Asserts stdout contains expected output

Parameters
string $expected
Expected output
string $message optional ''
Failure message

assertOutputContainsRow() protected ¶

assertOutputContainsRow( array $row , string $message = '' )

Check that a row of cells exists in the output.

Parameters
array $row
Row of cells to ensure exist in the output.
string $message optional ''
Failure message.

assertOutputEmpty() public ¶

assertOutputEmpty( string $message = '' )

Asserts that stdout is empty

Parameters
string $message optional ''
The message to output when the assertion fails.

assertOutputNotContains() public ¶

assertOutputNotContains( string $expected , string $message = '' )

Asserts stdout does not contain expected output

Parameters
string $expected
Expected output
string $message optional ''
Failure message

assertOutputRegExp() public ¶

assertOutputRegExp( string $pattern , string $message = '' )

Asserts stdout contains expected regexp

Parameters
string $pattern
Expected pattern
string $message optional ''
Failure message

cleanupConsoleTrait() public ¶

cleanupConsoleTrait( )

Cleans state to get ready for the next test

After

commandStringToArgs() protected ¶

commandStringToArgs( string $command )

Creates an $argv array from a command string

Parameters
string $command
Command string
Returns
array

exec() public ¶

exec( string $command , array $input = [] )

Runs cli integration test

Parameters
string $command
Command to run
array $input optional []
Input values to pass to an interactive shell

makeRunner() protected ¶

makeRunner( )

Builds the appropriate command dispatcher

Returns
Cake\Console\CommandRunner|Cake\TestSuite\LegacyCommandRunner

useCommandRunner() public ¶

useCommandRunner( )

Set this test case to use the CommandRunner rather than the legacy ShellDispatcher

Properties detail

$_err ¶

protected Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null

Console error output stub

$_exitCode ¶

protected integer|null

Last exit code

$_in ¶

protected Cake\Console\ConsoleInput|PHPUnit_Framework_MockObject_MockObject|null

Console input mock

$_out ¶

protected Cake\TestSuite\Stub\ConsoleOutput|PHPUnit_Framework_MockObject_MockObject|null

Console output stub

$_useCommandRunner ¶

protected boolean

Whether or not to use the CommandRunner

false
Follow @CakePHP
#IRC
OpenHub
Rackspace
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Logos & Trademarks
  • Community
  • Team
  • Issues (Github)
  • YouTube Channel
  • Get Involved
  • Bakery
  • Featured Resources
  • Newsletter
  • Certification
  • My CakePHP
  • CakeFest
  • Facebook
  • Twitter
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs