Skip to content

Commit

Permalink
[Maintenance] Transform email html content to text
Browse files Browse the repository at this point in the history
Fix possible false-negative case in EmailChecker
  • Loading branch information
NoResponseMate authored and Zales0123 committed Oct 5, 2022
1 parent 8ffa91d commit 04963ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Sylius/Component/Core/Test/Services/EmailChecker.php
Expand Up @@ -44,7 +44,11 @@ public function hasMessageTo(string $message, string $recipient): bool

foreach ($messages as $email) {
if ($this->isMessageTo($email, $recipient)) {
return str_contains($email->getHtmlBody(), $message);
$emailTextContent = trim(preg_replace('/\n+\s+/', ' ', strip_tags($email->getHtmlBody())));

if (str_contains($emailTextContent, $message)) {
return true;
}
}
}

Expand Down

0 comments on commit 04963ce

Please sign in to comment.