OptionsRequestSubscriber example

/** * @covers ::onRequest */
  public function testWithNonOptionRequest() {
    $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());
  }

  /** * @covers ::onRequest */
  public function testWithoutMatchingRoutes() {
    $kernel = $this->prophesize(HttpKernelInterface::class);
    
Home | Imprint | This part of the site doesn't use cookies.