public function testEndSessionAuthenticatedWithOutdatedIdleXmlHttpRequest()
 {
     $app = new Application('test');
     $app['dispatcher']->addSubscriber(new SessionManagerSubscriber($app));
     $app['authentication'] = $this->getMockBuilder('Alchemy\\Phrasea\\Authentication\\Authenticator')->disableOriginalConstructor()->getMock();
     $app['authentication']->expects($this->any())->method('isAuthenticated')->will($this->returnValue(true));
     $app['authentication']->expects($this->once())->method('closeAccount')->will($this->returnValue(null));
     $session = new Session();
     $session->setUpdated(new \DateTime('-1 hour'));
     $app['EM'] = $this->getMockBuilder('Doctrine\\ORM\\EntityManager')->disableOriginalConstructor()->getMock();
     $app['repo.sessions'] = $this->getMockBuilder('Doctrine\\Common\\Persistence\\ObjectRepository')->getMock();
     $app['repo.sessions']->expects($this->once())->method('find')->will($this->returnValue($session));
     $app['EM']->expects($this->any())->method('persist')->will($this->returnValue(null));
     $app['EM']->expects($this->any())->method('flush')->will($this->returnValue(null));
     $app['phraseanet.configuration']['session'] = ['idle' => 10, 'lifetime' => 60475];
     $app->get('/login', function () {
         return '';
     })->bind("homepage");
     $app->get('/prod', function () {
         return '';
     });
     $client = new Client($app);
     $client->request('GET', '/prod', [], [], ['HTTP_ACCEPT' => 'application/json', 'HTTP_X-Requested-With' => 'XMLHttpRequest']);
     $this->assertTrue($client->getResponse()->isClientError());
     $this->assertNotNUll($client->getResponse()->headers->get('x-phraseanet-end-session'));
 }
 /**
  * {@inheritDoc}
  */
 public function setUpdated(\DateTime $updated)
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'setUpdated', array($updated));
     return parent::setUpdated($updated);
 }