/**
  * @test
  */
 public function willSetResponseFromFactoryOnEvent()
 {
     $request = new Request();
     $response = new Response();
     $result = [uniqid()];
     $eventMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\Event\\GetResponseForControllerResultEvent')->disableOriginalConstructor()->getMock();
     $eventMock->expects($this->once())->method('getRequest')->willReturn($request);
     $eventMock->expects($this->once())->method('getControllerResult')->willReturn($result);
     $eventMock->expects($this->once())->method('setResponse')->willReturn($response);
     $factoryMock = $this->getMockBuilder('KleijnWeb\\SwaggerBundle\\Response\\ResponseFactory')->disableOriginalConstructor()->getMock();
     $factoryMock->expects($this->once())->method('createResponse')->with($request, $result)->willReturn($response);
     $listener = new ViewListener($factoryMock);
     $listener->onKernelView($eventMock);
 }
 /**
  * @test
  */
 public function willSetResponseFromFactoryOnEvent()
 {
     $request = new Request();
     $response = new Response();
     $result = [uniqid()];
     $eventMock = $this->getMockBuilder(GetResponseForControllerResultEvent::class)->disableOriginalConstructor()->getMock();
     $eventMock->expects($this->once())->method('getRequest')->willReturn($request);
     $eventMock->expects($this->once())->method('getControllerResult')->willReturn($result);
     $eventMock->expects($this->once())->method('setResponse')->willReturn($response);
     $factoryMock = $this->getMockBuilder(ResponseFactory::class)->disableOriginalConstructor()->getMock();
     $factoryMock->expects($this->once())->method('createResponse')->with($request, $result)->willReturn($response);
     /** @var ResponseFactory $factoryMock */
     $listener = new ViewListener($factoryMock);
     /** @var GetResponseForControllerResultEvent $eventMock */
     $listener->onKernelView($eventMock);
 }