\Cake\TestSuiteMiddlewareDispatcher

Dispatches a request capturing the response for integration testing purposes into the Cake\Http stack.

Summary

Methods
Properties
Constants
__construct()
resolveUrl()
execute()
No public properties found
No constants found
resolveRoute()
_createRequest()
$_test
$_class
$_constructorArgs
$app
N/A
No private methods found
No private properties found
N/A

Properties

$_class

$_class : string

The application class name

Type

string

$_constructorArgs

$_constructorArgs : array

Constructor arguments for your application class.

Type

array

Methods

__construct()

__construct(\Cake\TestSuite\IntegrationTestCase  $test, string|null  $class = null, array|null  $constructorArgs = null, boolean  $disableRouterReload = false) 

Constructor

Parameters

\Cake\TestSuite\IntegrationTestCase $test

The test case to run.

string|null $class

The application class name. Defaults to App\Application.

array|null $constructorArgs

The constructor arguments for your application class. Defaults to ['./config']

boolean $disableRouterReload

Disable Router::reload() call when resolving URLs. This flag may be necessary if you are using Router methods in your test case setup, and using array URLs when doing requests in your tests.

Throws

\LogicException

If it cannot load class for use in integration testing.

resolveUrl()

resolveUrl(array|string  $url) : string

Resolve the provided URL into a string.

Parameters

array|string $url

The URL array/string to resolve.

Returns

string

execute()

execute(array  $requestSpec) : \Psr\Http\Message\ResponseInterface

Run a request and get the response.

Parameters

array $requestSpec

The request spec to execute.

Returns

\Psr\Http\Message\ResponseInterface

The generated response.

resolveRoute()

resolveRoute(array  $url) : string

Convert a URL array into a string URL via routing.

Parameters

array $url

The url to resolve

Returns

string

_createRequest()

_createRequest(array  $spec) : \Psr\Http\Message\ServerRequestInterface

Create a PSR7 request from the request spec.

Parameters

array $spec

The request spec.

Returns

\Psr\Http\Message\ServerRequestInterface