public function onCoreResponse(FilterResponseEvent $event)
 {
     $response = $event->getResponse();
     if (!$response->isRedirection()) {
         parent::onCoreResponse($event);
     }
 }
 /**
  * Test that the listener correctly alters the http headers when the editor is enabled.
  */
 public function testPageIsEditor()
 {
     // GIVEN
     $this->cmsSelector->expects($this->once())->method('isEditor')->will($this->returnValue(true));
     $event = $this->getMockEvent('inner');
     // WHEN
     $this->listener->onCoreResponse($event);
     // THEN
     $this->assertFalse($event->getResponse()->isCacheable(), 'Should not be cacheable in editor mode');
     // assert a cookie has been set in the response headers
     $cookies = $event->getResponse()->headers->getCookies();
     $foundCookie = false;
     foreach ($cookies as $cookie) {
         if ($cookie->getName() == 'sonata_page_is_editor') {
             $this->assertEquals(1, $cookie->getValue());
             $foundCookie = true;
         }
     }
     $this->assertTrue($foundCookie, 'Should have found the editor mode cookie');
 }