Skip to content

Commit a5a79b5

Browse files
committed
accountdeletionrequesttest don't leave junk behind
1 parent 8a7b2bd commit a5a79b5

File tree

1 file changed

+25
-15
lines changed

1 file changed

+25
-15
lines changed

test/functional/AccountDeletionRequestTest.php

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,21 @@ public function testRequestAccountDeletionUserHasNoGroups()
3737
switchUser(...getUserHasNotRequestedAccountDeletionHasNoGroups());
3838
$this->assertEmpty($USER->getGroups());
3939
$this->assertNumberAccountDeletionRequests(0);
40-
post(
41-
__DIR__ . "/../../webroot/panel/account.php",
42-
["form_type" => "account_deletion_request"]
43-
);
44-
$this->assertNumberAccountDeletionRequests(1);
45-
post(
46-
__DIR__ . "/../../webroot/panel/account.php",
47-
["form_type" => "account_deletion_request"]
48-
);
49-
$this->assertNumberAccountDeletionRequests(1);
40+
try {
41+
post(
42+
__DIR__ . "/../../webroot/panel/account.php",
43+
["form_type" => "account_deletion_request"]
44+
);
45+
$this->assertNumberAccountDeletionRequests(1);
46+
post(
47+
__DIR__ . "/../../webroot/panel/account.php",
48+
["form_type" => "account_deletion_request"]
49+
);
50+
$this->assertNumberAccountDeletionRequests(1);
51+
} finally {
52+
$SQL->removeRequest($USER->getUID());
53+
$this->assertNumberAccountDeletionRequests(0);
54+
}
5055
}
5156

5257
public function testRequestAccountDeletionUserHasGroup()
@@ -56,10 +61,15 @@ public function testRequestAccountDeletionUserHasGroup()
5661
switchUser(...getUserHasNotRequestedAccountDeletionHasGroup());
5762
$this->assertNotEmpty($USER->getGroups());
5863
$this->assertNumberAccountDeletionRequests(0);
59-
post(
60-
__DIR__ . "/../../webroot/panel/account.php",
61-
["form_type" => "account_deletion_request"]
62-
);
63-
$this->assertNumberAccountDeletionRequests(0);
64+
try {
65+
post(
66+
__DIR__ . "/../../webroot/panel/account.php",
67+
["form_type" => "account_deletion_request"]
68+
);
69+
$this->assertNumberAccountDeletionRequests(0);
70+
} finally {
71+
$SQL->removeRequest($USER->getUID());
72+
$this->assertNumberAccountDeletionRequests(0);
73+
}
6474
}
6575
}

0 commit comments

Comments
 (0)