public function RouteNormalizerRequestSubscriberTest::testSkipIfRequestAttribute in Redirect 8
@covers ::onKernelRequestRedirect
File
- tests/
src/ Unit/ RouteNormalizerRequestSubscriberTest.php, line 68
Class
- RouteNormalizerRequestSubscriberTest
- Tests the route normalizer.
Namespace
Drupal\Tests\redirect\UnitCode
public function testSkipIfRequestAttribute() {
$request_uri = 'https://example.com/route-to-normalize';
$request_query = [];
$event = $this
->getGetResponseEventStub($request_uri, http_build_query($request_query), HttpKernelInterface::MASTER_REQUEST, TRUE);
// We set '_disable_route_normalizer' as a request attribute and expect to leave onKernelRequestRedirect at the beginning,
// i.e. $this->redirectChecker->canRedirect($request) should never be called.
$subscriber = $this
->getSubscriber($request_uri, TRUE, FALSE);
$subscriber
->onKernelRequestRedirect($event);
}