From c1e8bb05521f0d59367dd5029a14e23d3d592053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Burnichon?= Date: Wed, 9 Dec 2015 12:52:53 +0100 Subject: [PATCH] UserManipulator should change login on deletion. PHRAS-812 --- .../Phrasea/Model/Manipulator/UserManipulator.php | 1 + .../Tests/Phrasea/Functional/UserDeletionTest.php | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php b/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php index 07e2a15570..e8a5fc8128 100644 --- a/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php +++ b/lib/Alchemy/Phrasea/Model/Manipulator/UserManipulator.php @@ -104,6 +104,7 @@ class UserManipulator implements ManipulatorInterface $old_login = $user->getLogin(); $old_email = $user->getEmail(); + $user->setLogin(sprintf('(#deleted_%s_%d)', $old_login, $old_id)); $user->setDeleted(true); $user->setEmail(null); diff --git a/tests/Alchemy/Tests/Phrasea/Functional/UserDeletionTest.php b/tests/Alchemy/Tests/Phrasea/Functional/UserDeletionTest.php index 0a4c11afa3..5ca1dcfaf0 100644 --- a/tests/Alchemy/Tests/Phrasea/Functional/UserDeletionTest.php +++ b/tests/Alchemy/Tests/Phrasea/Functional/UserDeletionTest.php @@ -59,6 +59,9 @@ class UserDeletionTest extends \PhraseanetAuthenticatedWebTestCase $this->apiApplicationManipulator->update($this->apiApplication); } + /** + * @see https://phraseanet.atlassian.net/browse/PHRAS-811 + */ public function testRemoveUserWhichLoggedViaOAuthDoesNotThrowException() { $app = $this->getApplication(); @@ -84,6 +87,16 @@ class UserDeletionTest extends \PhraseanetAuthenticatedWebTestCase $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() { if ($this->apiApplication) {