function OptionsRequestSubscriberTest::testWithoutMatchingRoutes
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\OptionsRequestSubscriberTest::testWithoutMatchingRoutes()
- 10 core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\OptionsRequestSubscriberTest::testWithoutMatchingRoutes()
- 11.x core/tests/Drupal/Tests/Core/EventSubscriber/OptionsRequestSubscriberTest.php \Drupal\Tests\Core\EventSubscriber\OptionsRequestSubscriberTest::testWithoutMatchingRoutes()
@covers ::onRequest
File
-
core/
tests/ Drupal/ Tests/ Core/ EventSubscriber/ OptionsRequestSubscriberTest.php, line 40
Class
- OptionsRequestSubscriberTest
- @coversDefaultClass \Drupal\Core\EventSubscriber\OptionsRequestSubscriber @group EventSubscriber
Namespace
Drupal\Tests\Core\EventSubscriberCode
public function testWithoutMatchingRoutes() {
$kernel = $this->prophesize(HttpKernelInterface::class);
$request = Request::create('/example', 'OPTIONS');
$route_provider = $this->prophesize(RouteProviderInterface::class);
$route_provider->getRouteCollectionForRequest($request)
->willReturn(new RouteCollection())
->shouldBeCalled();
$subscriber = new OptionsRequestSubscriber($route_provider->reveal());
$event = new GetResponseEvent($kernel->reveal(), $request, HttpKernelInterface::MASTER_REQUEST);
$subscriber->onRequest($event);
$this->assertFalse($event->hasResponse());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.