public function RedirectResponseSubscriberTest::testDestinationRedirectWithInvalidUrl in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\RedirectResponseSubscriberTest::testDestinationRedirectWithInvalidUrl()
- 9 core/tests/Drupal/Tests/Core/EventSubscriber/RedirectResponseSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\RedirectResponseSubscriberTest::testDestinationRedirectWithInvalidUrl()
@dataProvider providerTestDestinationRedirectWithInvalidUrl
File
- core/
tests/ Drupal/ Tests/ Core/ EventSubscriber/ RedirectResponseSubscriberTest.php, line 166
Class
- RedirectResponseSubscriberTest
- @coversDefaultClass \Drupal\Core\EventSubscriber\RedirectResponseSubscriber @group EventSubscriber
Namespace
Drupal\Tests\Core\EventSubscriberCode
public function testDestinationRedirectWithInvalidUrl(Request $request) {
$dispatcher = new EventDispatcher(\Drupal::getContainer());
$kernel = $this
->createMock('Symfony\\Component\\HttpKernel\\HttpKernelInterface');
$response = new RedirectResponse('http://example.com/drupal');
$listener = new RedirectResponseSubscriber($this->urlAssembler, $this->requestContext);
$dispatcher
->addListener(KernelEvents::RESPONSE, [
$listener,
'checkRedirectUrl',
]);
$event = new ResponseEvent($kernel, $request, HttpKernelInterface::SUB_REQUEST, $response);
$this
->expectError();
$dispatcher
->dispatch($event, KernelEvents::RESPONSE);
}