Skip to content

Commit c658fc3

Browse files
fix mail cleanup
1 parent 2dd40cf commit c658fc3

File tree

5 files changed

+41
-32
lines changed

5 files changed

+41
-32
lines changed

tests/acceptance/bootstrap/NotificationContext.php

Lines changed: 40 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,10 @@ public function getLastNotificationId(): array {
4848
}
4949

5050
/**
51-
* @AfterScenario
51+
* delete de-provisioning notification
5252
*
5353
* @return void
54+
* @throws GuzzleException
5455
*/
5556
public function deleteDeprovisioningNotification(): void {
5657
$payload["ids"] = ["deprovision"];
@@ -66,6 +67,41 @@ public function deleteDeprovisioningNotification(): void {
6667
);
6768
}
6869

70+
/**
71+
* Delete all the inbucket emails
72+
*
73+
* @return void
74+
* @throws GuzzleException
75+
*/
76+
public function clearInbucketMessages(): void {
77+
try {
78+
$usersList = $this->featureContext->getAllCreatedUsers();
79+
foreach ($usersList as $emailRecipient) {
80+
EmailHelper::deleteAllEmailsForAMailbox(
81+
EmailHelper::getLocalEmailUrl(),
82+
$this->featureContext->getStepLineRef(),
83+
$emailRecipient['email']
84+
);
85+
}
86+
} catch (Exception $e) {
87+
echo __METHOD__ .
88+
" could not delete inbucket messages, is inbucket set up?\n" .
89+
$e->getMessage();
90+
}
91+
}
92+
93+
/**
94+
* @AfterScenario
95+
*
96+
* @return void
97+
* @throws GuzzleException
98+
* @throws JsonException
99+
*/
100+
public function deleteAllNotifications(): void {
101+
$this->deleteDeprovisioningNotification();
102+
$this->clearInbucketMessages();
103+
}
104+
69105
/**
70106
* @var string
71107
*/
@@ -151,7 +187,7 @@ public function userListAllNotifications(string $user): void {
151187
* @throws GuzzleException
152188
* @throws JsonException
153189
*/
154-
public function deleteAllNotifications(string $user): ResponseInterface {
190+
public function deleteAllInAppNotifications(string $user): ResponseInterface {
155191
$response = $this->listAllNotifications($user);
156192
if (isset($this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data)) {
157193
$responseBody = $this->featureContext->getJsonDecodedResponseBodyContent($response)->ocs->data;
@@ -173,7 +209,7 @@ public function deleteAllNotifications(string $user): ResponseInterface {
173209
* @throws JsonException
174210
*/
175211
public function userDeletesAllNotifications(string $user): void {
176-
$response = $this->deleteAllNotifications($user);
212+
$response = $this->deleteAllInAppNotifications($user);
177213
$this->featureContext->setResponse($response);
178214
}
179215

@@ -187,7 +223,7 @@ public function userDeletesAllNotifications(string $user): void {
187223
* @throws JsonException
188224
*/
189225
public function userHasDeletedAllNotifications(string $user): void {
190-
$response = $this->deleteAllNotifications($user);
226+
$response = $this->deleteAllInAppNotifications($user);
191227
$this->featureContext->theHTTPStatusCodeShouldBe(200, "", $response);
192228
}
193229

@@ -661,30 +697,6 @@ public function assertEmailContains(
661697
);
662698
}
663699

664-
/**
665-
* Delete all the inbucket emails
666-
*
667-
* @AfterScenario @email
668-
*
669-
* @return void
670-
*/
671-
public function clearInbucketMessages(): void {
672-
try {
673-
$usersList = $this->featureContext->getAllCreatedUsers();
674-
foreach ($usersList as $emailRecipient) {
675-
EmailHelper::deleteAllEmailsForAMailbox(
676-
EmailHelper::getLocalEmailUrl(),
677-
$this->featureContext->getStepLineRef(),
678-
$emailRecipient['email']
679-
);
680-
}
681-
} catch (Exception $e) {
682-
echo __METHOD__ .
683-
" could not delete inbucket messages, is inbucket set up?\n" .
684-
$e->getMessage();
685-
}
686-
}
687-
688700
/**
689701
*
690702
* @param string|null $user

tests/acceptance/features/apiNotification/emailNotification.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@email
21
Feature: Email notification
32
As a user
43
I want to get email notification of events related to me

tests/acceptance/features/apiNotification/shareExpireNotification.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@email
21
Feature: Share Expiry Notification
32
As a user
43
I want to be notified when share expires

tests/acceptance/features/apiOcm/createInvitation.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Feature: create invitation
7676
| @domain.com | 400 |
7777
| user@domain..com | 400 |
7878

79-
@email @issue-10059
79+
@issue-10059
8080
Scenario: federated user gets an email notification if their email was specified when creating the federation share invitation
8181
Given using server "REMOTE"
8282
And user "David" has been created with default attributes

tests/acceptance/features/apiSettings/notificationSetting.feature

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
@email
21
Feature: Notification Settings
32
As a user
43
I want to manage my notification settings

0 commit comments

Comments
 (0)