From 800b4e21bbc68884b78f2729afecf113d1b04a26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20B=C3=BCrk?= <stefan@buerk.tech>
Date: Sat, 27 Nov 2021 01:10:44 +0100
Subject: [PATCH] [BUGFIX] Prepare changed json_response middleware
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The json_response functional test extension will soon
avoid returning json encoded responses. This will make
the functional frontend test suite fully transparent
regarding responses.
This patch prepares a couple of frontend functional
tests towards this change.

Resolves: #96112
Releases: master, 11.5
Change-Id: I8116caf08e4b8b76ad5d23b49954d9cb78d1c4de
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/72319
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
---
 .../Functional/SiteHandling/SlugSiteRequestTest.php    | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php
index 4d249b1c6568..9560a899bd72 100644
--- a/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php
+++ b/typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php
@@ -865,14 +865,13 @@ class SlugSiteRequestTest extends AbstractTestCase
             $this->internalRequestContext
                 ->withFrontendUserId($frontendUserId)
         );
-        $json = json_decode((string)$response->getBody(), true);
 
         self::assertSame(
             403,
             $response->getStatusCode()
         );
         self::assertThat(
-            $json['body'] ?? null,
+            (string)$response->getBody(),
             self::logicalOr(
                 self::stringContains('That page is forbidden to you'),
                 self::stringContains('ID was not an accessible page'),
@@ -1029,14 +1028,13 @@ class SlugSiteRequestTest extends AbstractTestCase
             $this->internalRequestContext
                 ->withFrontendUserId($frontendUserId)
         );
-        $json = json_decode((string)$response->getBody(), true);
 
         self::assertSame(
             403,
             $response->getStatusCode()
         );
         self::assertThat(
-            $json['body'] ?? null,
+            (string)$response->getBody(),
             self::logicalOr(
                 self::stringContains('That page is forbidden to you'),
                 self::stringContains('ID was not an accessible page'),
@@ -1226,13 +1224,13 @@ class SlugSiteRequestTest extends AbstractTestCase
             new InternalRequest($uri),
             $this->internalRequestContext
         );
-        $json = json_decode((string)$response->getBody(), true);
+
         self::assertSame(
             404,
             $response->getStatusCode()
         );
         self::assertThat(
-            $json['body'] ?? null,
+            (string)$response->getBody(),
             self::stringContains('That page was not found')
         );
     }
-- 
GitLab