private function doTestRequest()
 {
     $controller = new FooController();
     $this->event = $this->getFilterControllerEvent(array($controller, 'barAction'), $this->request);
     $this->listener->onKernelController($this->event);
     $this->statsTableListener->onKernelController($this->event);
     $this->assertNotNull($this->getReadedStatsTable());
     $this->assertEquals('json', $this->getReadedStatsTable()->getFormat());
 }
 public function testJSONResponseWithExistingResponse()
 {
     $request = $this->getRequest(true, 'json');
     $response = new Response();
     $response->headers->set('X-Custom', 'value');
     $statsTable = new StatsTable(array(array('what' => 'else ?')));
     $event = $this->getGetResponseForControllerResultEvent($request, $statsTable, $response);
     $this->listener->onKernelView($event);
     $response = $event->getResponse();
     $this->assertNotNull($response);
     $this->assertContains('application/json', $response->headers->get('content-type'));
     $this->assertEquals('value', $response->headers->get('X-Custom'));
 }