Class MiddlewareDispatcher
Dispatches a request capturing the response for integration testing purposes into the Cake\Http stack.
Namespace: Cake\TestSuite
Property Summary
-
$_class protected
string
The application class name
-
$_constructorArgs protected
array
Constructor arguments for your application class.
-
$_test protected
Cake\TestSuite\IntegrationTestCase
The test case being run.
Method Summary
-
__construct() public
Constructor
-
_createRequest() protected
Create a PSR7 request from the request spec.
-
execute() public
Run a request and get the response.
Method Detail
__construct() ¶ public
__construct(Cake\TestSuite\IntegrationTestCase $test, string|null $class = null, array|null $constructorArgs = null)
Constructor
Parameters
-
Cake\TestSuite\IntegrationTestCase
$test The test case to run.
-
string|null
$class optional The application class name. Defaults to App\Application.
-
array|null
$constructorArgs optional The constructor arguments for your application class. Defaults to
['./config']
_createRequest() ¶ protected
_createRequest(array $spec): Psr\Http\Message\RequestInterface
Create a PSR7 request from the request spec.
Parameters
-
array
$spec The request spec.
Returns
Psr\Http\Message\RequestInterface
execute() ¶ public
execute(Cake\Http\ServerRequest $request): Psr\Http\Message\ResponseInterface
Run a request and get the response.
Parameters
-
Cake\Http\ServerRequest
$request The request to execute.
Returns
Psr\Http\Message\ResponseInterface