mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-16 14:33:14 +00:00
allow multiple calls to closeAccount() (#4201)
This commit is contained in:
@@ -133,13 +133,11 @@ class Authenticator
|
|||||||
*/
|
*/
|
||||||
public function closeAccount()
|
public function closeAccount()
|
||||||
{
|
{
|
||||||
if (!$this->session->has('session_id')) {
|
if ($this->session->has('session_id')) {
|
||||||
throw new RuntimeException('No session to close.');
|
if (null !== $session = $this->app['repo.sessions']->find($this->session->get('session_id'))) {
|
||||||
}
|
$this->em->remove($session);
|
||||||
|
$this->em->flush();
|
||||||
if (null !== $session = $this->app['repo.sessions']->find($this->session->get('session_id'))) {
|
}
|
||||||
$this->em->remove($session);
|
|
||||||
$this->em->flush();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->session->invalidate();
|
$this->session->invalidate();
|
||||||
|
@@ -214,14 +214,14 @@ class AuthenticatorTest extends \PhraseanetTestCase
|
|||||||
$this->assertNull($authenticator->getUser());
|
$this->assertNull($authenticator->getUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCloseAccountWhenNoSessionThrowsAnException()
|
// public function testCloseAccountWhenNoSessionThrowsAnException()
|
||||||
{
|
// {
|
||||||
$app = $this->getApplication();
|
// $app = $this->getApplication();
|
||||||
|
//
|
||||||
$authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']);
|
// $authenticator = new Authenticator($app, $app['browser'], $app['session'], $app['orm.em']);
|
||||||
$this->setExpectedException('Alchemy\Phrasea\Exception\RuntimeException', 'No session to close.');
|
// $this->setExpectedException('Alchemy\Phrasea\Exception\RuntimeException', 'No session to close.');
|
||||||
$authenticator->closeAccount();
|
// $authenticator->closeAccount();
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers Alchemy\Phrasea\Authentication\Authenticator::isAuthenticated
|
* @covers Alchemy\Phrasea\Authentication\Authenticator::isAuthenticated
|
||||||
|
Reference in New Issue
Block a user