Fix #953 Close session properly

Fix tests
This commit is contained in:
Nicolas Le Goff
2013-05-29 20:43:56 +02:00
parent e68900b56c
commit a15ee1d729
3 changed files with 4 additions and 4 deletions

View File

@@ -117,7 +117,7 @@ class Authenticator
*/ */
public function closeAccount() public function closeAccount()
{ {
$this->session->clear(); $this->session->invalidate();
$this->reinitUser(); $this->reinitUser();
return $this; return $this;

View File

@@ -631,7 +631,7 @@ class Login implements ControllerProviderInterface
$app['dispatcher']->dispatch(PhraseaEvents::LOGOUT, new LogoutEvent($app)); $app['dispatcher']->dispatch(PhraseaEvents::LOGOUT, new LogoutEvent($app));
$app['authentication']->closeAccount(); $app['authentication']->closeAccount();
$app->addFlash('info', 'Vous etes maintenant deconnecte. A bientot.'); $app->addFlash('info', _('Vous etes maintenant deconnecte. A bientot.'));
$response = new RedirectResponse($app->path('root', array( $response = new RedirectResponse($app->path('root', array(
'redirect' => $request->query->get("redirect") 'redirect' => $request->query->get("redirect")

View File

@@ -57,8 +57,8 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/ */
public function testLoginError($type, $message) public function testLoginError($type, $message)
{ {
self::$DI['app']->addFlash($type, $message);
self::$DI['app']['authentication']->closeAccount(); self::$DI['app']['authentication']->closeAccount();
self::$DI['app']->addFlash($type, $message);
$crawler = self::$DI['client']->request('GET', '/login/'); $crawler = self::$DI['client']->request('GET', '/login/');
@@ -342,9 +342,9 @@ class LoginTest extends \PhraseanetWebTestCaseAuthenticatedAbstract
*/ */
public function testRenewPasswordPageShowsFlashMessages($type, $message) public function testRenewPasswordPageShowsFlashMessages($type, $message)
{ {
self::$DI['app']['authentication']->closeAccount();
self::$DI['app']->addFlash($type, $message); self::$DI['app']->addFlash($type, $message);
self::$DI['app']['authentication']->closeAccount();
$token = self::$DI['app']['tokens']->getUrlToken(\random::TYPE_PASSWORD, self::$DI['user']->get_id()); $token = self::$DI['app']['tokens']->getUrlToken(\random::TYPE_PASSWORD, self::$DI['user']->get_id());
$crawler = self::$DI['client']->request('GET', '/login/renew-password/', array( $crawler = self::$DI['client']->request('GET', '/login/renew-password/', array(