W3cubDocs

/CakePHP 4.4

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

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

Property Detail

$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.4/class-Cake.TestSuite.MiddlewareDispatcher.html