Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit aaba76d

Browse files
committed
ENH: refs #0340. Test correct passing of user id for user deletion
1 parent 1f0b30e commit aaba76d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

core/controllers/UserController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,10 @@ public function deleteAction()
843843
// log out if user is deleting his or her own account
844844
$this->userSession->Dao = null;
845845
Zend_Session::ForgetMe();
846-
setcookie('midasUtil', null, time() + 60 * 60 * 24 * 30, '/');
846+
if(!$this->isTestingEnv())
847+
{
848+
setcookie('midasUtil', null, time() + 60 * 60 * 24 * 30, '/');
849+
}
847850
}
848851
$this->_helper->viewRenderer->setNoRender();
849852
$this->disableLayout();

core/tests/controllers/UserControllerTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ public function testDeleteUserAction()
282282
// Render the delete dialog and make sure it has correct text
283283
$this->resetAll();
284284
$this->dispatchUrI('/user/deletedialog?userId='.$user1->getKey(), $adminUser);
285+
$this->assertQuery('input[type="hidden"][name="userId"][value="'.$user1->getKey().'"]');
285286
$this->assertQueryContentContains('#deleteDialogUserName', $user1->getFirstname().' '.$user1->getLastname());
286287

287288
// Should fail if we aren't logged in
@@ -339,6 +340,7 @@ public function testDeleteSelfAction()
339340
// Render the delete dialog and make sure it has correct text for self-deletion
340341
$this->resetAll();
341342
$this->dispatchUrI('/user/deletedialog?userId='.$user1->getKey(), $user1);
343+
$this->assertQuery('input[type="hidden"][name="userId"][value="'.$user1->getKey().'"]');
342344
$this->assertTrue(strpos($this->getBody(), 'Are you sure you want to delete your user account?') !== false);
343345

344346
$oldRevisions = $user1->getItemrevisions();

0 commit comments

Comments
 (0)