function OptionsRequestSubscriberTest::testWithNonOptionRequest
Tests with non option request.
@legacy-covers ::onRequest
File
- 
              core/
tests/ Drupal/ Tests/ Core/ EventSubscriber/ OptionsRequestSubscriberTest.php, line 31  
Class
Namespace
Drupal\Tests\Core\EventSubscriberCode
public function testWithNonOptionRequest() : void {
  $kernel = $this->prophesize(HttpKernelInterface::class);
  $request = Request::create('/example', 'GET');
  $route_provider = $this->prophesize(RouteProviderInterface::class);
  $route_provider->getRouteCollectionForRequest($request)
    ->shouldNotBeCalled();
  $subscriber = new OptionsRequestSubscriber($route_provider->reveal());
  $event = new RequestEvent($kernel->reveal(), $request, HttpKernelInterface::MAIN_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.