Skip to content

Commit a720b37

Browse files
committed
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.
1 parent 3847a76 commit a720b37

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

phpunit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<server name="APP_AUTO_LANG_PUBLIC" value="true"/>
2222
<server name="APP_URL" value="http://bookstack.dev"/>
2323
<server name="ALLOWED_IFRAME_HOSTS" value=""/>
24+
<server name="ALLOWED_SSR_HOSTS" value="*"/>
2425
<server name="CACHE_DRIVER" value="array"/>
2526
<server name="SESSION_DRIVER" value="array"/>
2627
<server name="QUEUE_CONNECTION" value="sync"/>

tests/Activity/WatchTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public function test_notify_watch_parent_book_comments()
257257

258258
$notifications->assertSentTo($editor, function (CommentCreationNotification $notification) use ($editor, $admin, $entities) {
259259
$mail = $notification->toMail($editor);
260-
$mailContent = html_entity_decode(strip_tags($mail->render()));
260+
$mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES);
261261
return $mail->subject === 'New comment on page: ' . $entities['page']->getShortName()
262262
&& str_contains($mailContent, 'View Comment')
263263
&& str_contains($mailContent, 'Page Name: ' . $entities['page']->name)
@@ -280,7 +280,7 @@ public function test_notify_watch_parent_book_updates()
280280

281281
$notifications->assertSentTo($editor, function (PageUpdateNotification $notification) use ($editor, $admin) {
282282
$mail = $notification->toMail($editor);
283-
$mailContent = html_entity_decode(strip_tags($mail->render()));
283+
$mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES);
284284
return $mail->subject === 'Updated page: Updated page'
285285
&& str_contains($mailContent, 'View Page')
286286
&& str_contains($mailContent, 'Page Name: Updated page')
@@ -309,7 +309,7 @@ public function test_notify_watch_parent_book_new()
309309

310310
$notifications->assertSentTo($editor, function (PageCreationNotification $notification) use ($editor, $admin) {
311311
$mail = $notification->toMail($editor);
312-
$mailContent = html_entity_decode(strip_tags($mail->render()));
312+
$mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES);
313313
return $mail->subject === 'New page: My new page'
314314
&& str_contains($mailContent, 'View Page')
315315
&& str_contains($mailContent, 'Page Name: My new page')
@@ -347,7 +347,7 @@ public function test_notifications_sent_in_right_language()
347347
$notification = $notificationInfo[0]['notification'];
348348
$this->assertInstanceOf(BaseActivityNotification::class, $notification);
349349
$mail = $notification->toMail($editor);
350-
$mailContent = html_entity_decode(strip_tags($mail->render()));
350+
$mailContent = html_entity_decode(strip_tags($mail->render()), ENT_QUOTES);
351351
$this->assertStringContainsString('Name der Seite:', $mailContent);
352352
$this->assertStringContainsString('Diese Benachrichtigung wurde', $mailContent);
353353
$this->assertStringContainsString('Sollte es beim Anklicken der Schaltfläche', $mailContent);

0 commit comments

Comments
 (0)