test: refactor inbucket email cleanup function

Signed-off-by: prashant-gurung899 <prasantgrg777@gmail.com>
This commit is contained in:
prashant-gurung899 committed 2025-02-03 17:00:19 +05:45
1 parent 527cddbc64
commit 9bf869abf4
1 file changed
+7 -8
@@ -672,14 +672,13 @@ class NotificationContext implements Context {
*/
public function clearInbucketMessages(): void {
try {
if (!empty($this->featureContext->emailRecipients)) {
foreach ($this->featureContext->emailRecipients as $emailRecipient) {
EmailHelper::deleteAllEmailsForAMailbox(
EmailHelper::getLocalEmailUrl(),
$this->featureContext->getStepLineRef(),
$emailRecipient
);
}
$usersList = $this->featureContext->getAllCreatedUsers();
foreach ($usersList as $emailRecipient) {
EmailHelper::deleteAllEmailsForAMailbox(
EmailHelper::getLocalEmailUrl(),
$this->featureContext->getStepLineRef(),
$emailRecipient['email']
);
}
} catch (Exception $e) {
echo __METHOD__ .