Class MiddlewareDispatcher
Dispatches a request capturing the response for integration testing purposes into the Cake\Http stack.
Namespace: Cake\TestSuite
Property Summary
-
$app protected
Cake\Core\HttpApplicationInterface
The application that is being dispatched.
Method Summary
-
__construct() public
Constructor
-
_createRequest() protected
Create a PSR7 request from the request spec.
-
execute() public
Run a request and get the response.
-
resolveRoute() protected
Convert a URL array into a string URL via routing.
-
resolveUrl() public
Resolve the provided URL into a string.
Method Detail
__construct() ¶ public
__construct(Cake\Core\HttpApplicationInterface $app)
Constructor
Parameters
-
Cake\Core\HttpApplicationInterface
$app The test case to run.
_createRequest() ¶ protected
_createRequest(array<string, mixed> $spec): Cake\Http\ServerRequest
Create a PSR7 request from the request spec.
Parameters
-
array<string, mixed>
$spec The request spec.
Returns
Cake\Http\ServerRequest
execute() ¶ public
execute(array<string, mixed> $requestSpec): Psr\Http\Message\ResponseInterface
Run a request and get the response.
Parameters
-
array<string, mixed>
$requestSpec The request spec to execute.
Returns
Psr\Http\Message\ResponseInterface
Throws
LogicException
resolveRoute() ¶ protected
resolveRoute(array $url): string
Convert a URL array into a string URL via routing.
Parameters
-
array
$url The url to resolve
Returns
string
resolveUrl() ¶ public
resolveUrl(array|string $url): string
Resolve the provided URL into a string.
Parameters
-
array|string
$url The URL array/string to resolve.
Returns
string