@@ -37,16 +37,21 @@ public function testRequestAccountDeletionUserHasNoGroups()
37
37
switchUser (...getUserHasNotRequestedAccountDeletionHasNoGroups ());
38
38
$ this ->assertEmpty ($ USER ->getGroups ());
39
39
$ 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 ->deleteAccountDeletionRequest ($ USER ->getUID ());
53
+ $ this ->assertNumberAccountDeletionRequests (0 );
54
+ }
50
55
}
51
56
52
57
public function testRequestAccountDeletionUserHasGroup ()
@@ -56,10 +61,15 @@ public function testRequestAccountDeletionUserHasGroup()
56
61
switchUser (...getUserHasNotRequestedAccountDeletionHasGroup ());
57
62
$ this ->assertNotEmpty ($ USER ->getGroups ());
58
63
$ 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 ->deleteAccountDeletionRequest ($ USER ->getUID ());
72
+ $ this ->assertNumberAccountDeletionRequests (0 );
73
+ }
64
74
}
65
75
}
0 commit comments