PsrResponseSubscriber example

$factory = $this->getMockBuilder('Symfony\Bridge\PsrHttpMessage\HttpFoundationFactoryInterface')
      ->disableOriginalConstructor()
      ->getMock();
    $factory
      ->expects($this->any())
      ->method('createResponse')
      ->willReturn($this->createMock('Symfony\Component\HttpFoundation\Response'));

    $this->httpFoundationFactoryMock = $factory;

    $this->psrResponseSubscriber = new PsrResponseSubscriber($this->httpFoundationFactoryMock);
  }

  /** * Tests altering and finished event. * * @covers ::onKernelView */
  public function testConvertsControllerResult() {
    $event = $this->createEvent($this->createMock('Psr\Http\Message\ResponseInterface'));
    $this->psrResponseSubscriber->onKernelView($event);
    $this->assertInstanceOf(Response::class$event->getResponse());
  }
Home | Imprint | This part of the site doesn't use cookies.