Class MiddlewareDispatcher
Dispatches a request capturing the response for integration testing purposes into the Cake\Http stack.
Properties summary
- $_class protected
stringThe application class name
- $_constructorArgs protected
arrayConstructor arguments for your application class.
- $_test protected
\Cake\TestSuite\TestCaseThe test case being run.
- $app protected
\Cake\Core\HttpApplicationInterfaceThe application that is being dispatched.
Method Summary
Method Detail
__construct() public
__construct(\Cake\TestSuite\TestCase $test, ?string $class, ?array $constructorArgs)
Constructor
Parameters
-
\Cake\TestSuite\TestCase$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']
Throws
LogicExceptionIf it cannot load class for use in integration testing.
_createRequest() protected
_createRequest(array $spec)
Create a PSR7 request from the request spec.
Parameters
-
array$spec The request spec.
Returns
\Cake\Http\ServerRequestexecute() public
execute(array $requestSpec)
Run a request and get the response.
Parameters
-
array$requestSpec The request spec to execute.
Returns
\Psr\Http\Message\ResponseInterfaceThe generated response.
Throws
LogicExceptionresolveRoute() protected
resolveRoute(array $url)
Convert a URL array into a string URL via routing.
Parameters
-
array$url The url to resolve
Returns
stringresolveUrl() public
resolveUrl(mixed $url)
Resolve the provided URL into a string.
Parameters
-
array|string$url The URL array/string to resolve.
Returns
stringProperty Detail
$_class protected
The application class name
Type
string$_constructorArgs protected
Constructor arguments for your application class.
Type
array$_test protected
The test case being run.
Type
\Cake\TestSuite\TestCase$app protected
The application that is being dispatched.
Type
\Cake\Core\HttpApplicationInterface
© 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/4.0/class-Cake.TestSuite.MiddlewareDispatcher.html