From a6af6ada01a78b645bd644b9d472c5fc949c390f Mon Sep 17 00:00:00 2001 From: Nico Stapelbroek Date: Mon, 19 Mar 2018 23:55:38 +0100 Subject: [PATCH] Use htmlspecialchars in the assertion to match the blade escaping --- tests/Functional/Incident/MetaSeoTest.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/Functional/Incident/MetaSeoTest.php b/tests/Functional/Incident/MetaSeoTest.php index c6f6cd38..c1ea4761 100644 --- a/tests/Functional/Incident/MetaSeoTest.php +++ b/tests/Functional/Incident/MetaSeoTest.php @@ -68,17 +68,17 @@ class MetaSeoTest extends AbstractTestCase */ public function testCustomSeoDescriptionOnIncidentPage() { - $description = $this->fakerFactory->sentence; + $expectedDescription = htmlspecialchars($this->fakerFactory->sentence); - $incident = $this->createIncidentWithMeta(['seo' => ['description' => $description]]); + $incident = $this->createIncidentWithMeta(['seo' => ['description' => $expectedDescription]]); $page = $this->get(sprintf('/incidents/%d', $incident->id))->response; $this->assertContains( - sprintf('', $description), + sprintf('', $expectedDescription), $page->content() ); $this->assertContains( - sprintf('', $description), + sprintf('', $expectedDescription), $page->content() ); } @@ -89,7 +89,7 @@ class MetaSeoTest extends AbstractTestCase */ public function testCustomSeoTitleOnIncidentPage() { - $title = $this->fakerFactory->title; + $title = htmlspecialchars($this->fakerFactory->title); $incident = $this->createIncidentWithMeta(['seo' => ['title' => $title]]); $page = $this->get(sprintf('/incidents/%d', $incident->id))->response; @@ -116,7 +116,7 @@ class MetaSeoTest extends AbstractTestCase $expectedDescription = sprintf( 'Details and updates about the %s incident that occurred on %s', - $incident->name, + htmlspecialchars($incident->name), $presenter->occurred_at_formatted ); @@ -139,7 +139,7 @@ class MetaSeoTest extends AbstractTestCase public function testNoCustomSeoTitleOnIncidentPage() { $incident = $this->createIncidentWithMeta([]); - $expectedTitle = sprintf('%s | %s', $incident->name, $this->appName); + $expectedTitle = sprintf('%s | %s', htmlspecialchars($incident->name), $this->appName); $page = $this->get(sprintf('/incidents/%d', $incident->id))->response;