public function testRememberMeAuthentication()
 {
     $app = $this->createApplication();
     $client = new Client($app);
     $client->request('get', '/');
     $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'foo', '_remember_me' => 'true'));
     $client->followRedirect();
     $this->assertEquals('AUTHENTICATED_FULLY', $client->getResponse()->getContent());
     $this->assertNotNull($client->getCookiejar()->get('REMEMBERME'), 'The REMEMBERME cookie is set');
     $client->getCookiejar()->expire('MOCKSESSID');
     $client->request('get', '/');
     $this->assertEquals('AUTHENTICATED_REMEMBERED', $client->getResponse()->getContent());
     $client->request('get', '/logout');
     $client->followRedirect();
     $this->assertNull($client->getCookiejar()->get('REMEMBERME'), 'The REMEMBERME cookie has been removed');
 }
 public function testRememberMeAuthentication()
 {
     $app = $this->createApplication();
     $interactiveLogin = new InteractiveLoginTriggered();
     $app->on(SecurityEvents::INTERACTIVE_LOGIN, array($interactiveLogin, 'onInteractiveLogin'));
     $client = new Client($app);
     $client->request('get', '/');
     $this->assertFalse($interactiveLogin->triggered, 'The interactive login has not been triggered yet');
     $client->request('post', '/login_check', array('_username' => 'fabien', '_password' => 'foo', '_remember_me' => 'true'));
     $client->followRedirect();
     $this->assertEquals('AUTHENTICATED_FULLY', $client->getResponse()->getContent());
     $this->assertTrue($interactiveLogin->triggered, 'The interactive login has been triggered');
     $this->assertNotNull($client->getCookiejar()->get('REMEMBERME'), 'The REMEMBERME cookie is set');
     $event = false;
     $client->getCookiejar()->expire('MOCKSESSID');
     $client->request('get', '/');
     $this->assertEquals('AUTHENTICATED_REMEMBERED', $client->getResponse()->getContent());
     $this->assertTrue($interactiveLogin->triggered, 'The interactive login has been triggered');
     $client->request('get', '/logout');
     $client->followRedirect();
     $this->assertNull($client->getCookiejar()->get('REMEMBERME'), 'The REMEMBERME cookie has been removed');
 }