From a720b3725de75ab60037aec0394889152a5dca4a Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sat, 2 Sep 2023 15:39:45 +0100 Subject: [PATCH] Testing: Added entity decode flag and phpunit env option - Passed decode flags to provide consistent behaviour across PHP versions during testing. - Added env option to prevent local option taking action in PHPunit tests. --- phpunit.xml | 1 + tests/Activity/WatchTest.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 704372c5c..183e45637 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -21,6 +21,7 @@ + diff --git a/tests/Activity/WatchTest.php b/tests/Activity/WatchTest.php index d3c9387bb..72e6b37a5 100644 --- a/tests/Activity/WatchTest.php +++ b/tests/Activity/WatchTest.php @@ -257,7 +257,7 @@ class WatchTest extends TestCase $notifications->assertSentTo($editor, function (CommentCreationNotification $notification) use ($editor, $admin, $entities) { $mail = $notification->toMail($editor); - $mailContent = html_entity_decode(strip_tags($mail->render())); + $mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES); return $mail->subject === 'New comment on page: ' . $entities['page']->getShortName() && str_contains($mailContent, 'View Comment') && str_contains($mailContent, 'Page Name: ' . $entities['page']->name) @@ -280,7 +280,7 @@ class WatchTest extends TestCase $notifications->assertSentTo($editor, function (PageUpdateNotification $notification) use ($editor, $admin) { $mail = $notification->toMail($editor); - $mailContent = html_entity_decode(strip_tags($mail->render())); + $mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES); return $mail->subject === 'Updated page: Updated page' && str_contains($mailContent, 'View Page') && str_contains($mailContent, 'Page Name: Updated page') @@ -309,7 +309,7 @@ class WatchTest extends TestCase $notifications->assertSentTo($editor, function (PageCreationNotification $notification) use ($editor, $admin) { $mail = $notification->toMail($editor); - $mailContent = html_entity_decode(strip_tags($mail->render())); + $mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES); return $mail->subject === 'New page: My new page' && str_contains($mailContent, 'View Page') && str_contains($mailContent, 'Page Name: My new page') @@ -347,7 +347,7 @@ class WatchTest extends TestCase $notification = $notificationInfo[0]['notification']; $this->assertInstanceOf(BaseActivityNotification::class, $notification); $mail = $notification->toMail($editor); - $mailContent = html_entity_decode(strip_tags($mail->render())); + $mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES); $this->assertStringContainsString('Name der Seite:', $mailContent); $this->assertStringContainsString('Diese Benachrichtigung wurde', $mailContent); $this->assertStringContainsString('Sollte es beim Anklicken der Schaltfläche', $mailContent);