UserManipulator should change login on deletion.

PHRAS-812
This commit is contained in:
Benoît Burnichon
2015-12-09 12:52:53 +01:00
parent 5bb8d4167b
commit c1e8bb0552
2 changed files with 14 additions and 0 deletions

View File

@@ -104,6 +104,7 @@ class UserManipulator implements ManipulatorInterface
$old_login = $user->getLogin(); $old_login = $user->getLogin();
$old_email = $user->getEmail(); $old_email = $user->getEmail();
$user->setLogin(sprintf('(#deleted_%s_%d)', $old_login, $old_id));
$user->setDeleted(true); $user->setDeleted(true);
$user->setEmail(null); $user->setEmail(null);

View File

@@ -59,6 +59,9 @@ class UserDeletionTest extends \PhraseanetAuthenticatedWebTestCase
$this->apiApplicationManipulator->update($this->apiApplication); $this->apiApplicationManipulator->update($this->apiApplication);
} }
/**
* @see https://phraseanet.atlassian.net/browse/PHRAS-811
*/
public function testRemoveUserWhichLoggedViaOAuthDoesNotThrowException() public function testRemoveUserWhichLoggedViaOAuthDoesNotThrowException()
{ {
$app = $this->getApplication(); $app = $this->getApplication();
@@ -84,6 +87,16 @@ class UserDeletionTest extends \PhraseanetAuthenticatedWebTestCase
$this->apiApplication = null; $this->apiApplication = null;
} }
/**
* @see https://phraseanet.atlassian.net/browse/PHRAS-812
*/
public function testRemoveUserShouldChangeLogin()
{
$this->userManipulator->delete($this->user);
$this->assertNotEquals('login', $this->user->getLogin());
}
public function tearDown() public function tearDown()
{ {
if ($this->apiApplication) { if ($this->apiApplication) {