[TASK] Prepare Frontend Tests for additional site handling tests 63/60363/4
authorBenni Mack <benni@typo3.org>
Wed, 3 Apr 2019 09:55:36 +0000 (11:55 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Wed, 3 Apr 2019 14:12:12 +0000 (16:12 +0200)
Some test functionality regarding Site Handling is now sorted out in order
to add more tests.

- SiteConfiguration setup for tests is moved into a separate Trait.
- Code which is also used (in the future) for EXT:core and not
   just frontend is moved to EXT:core
- LocalizedFrontendPages now have a slug field as well.
- Regular Frontend JsonRenderer now also renders values
  from SiteLanguage config + context aspect

Resolves: #88060
Releases: master, 9.5
Change-Id: If859da89e4fcec16e3d1c2abb934eef040d4f386
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/60363
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
16 files changed:
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidError.html [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidJson.html [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PageError.txt [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PhpError.php [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/SiteHandling/SiteBasedTestTrait.php [new file with mode: 0644]
typo3/sysext/frontend/Tests/Functional/Rendering/DataSet/LiveDefaultPages.csv
typo3/sysext/frontend/Tests/Functional/SiteHandling/AbstractTestCase.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidError.html [deleted file]
typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidJson.html [deleted file]
typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PageError.txt [deleted file]
typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PhpError.php [deleted file]
typo3/sysext/frontend/Tests/Functional/SiteHandling/PlainRequestTest.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/SiteRequestTest.php
typo3/sysext/frontend/Tests/Functional/SiteHandling/SlugSiteRequestTest.php
typo3/sysext/frontend/Tests/Unit/Middleware/SiteBaseRedirectResolverTest.php

diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidError.html b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidError.html
new file mode 100644 (file)
index 0000000..4ed80f2
--- /dev/null
@@ -0,0 +1,3 @@
+uri: {request.uri}
+message: {message}
+reasons: <f:for each="{reasons}" as="reason" key="key">{key},</f:for>
diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidJson.html b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidJson.html
new file mode 100644 (file)
index 0000000..34e988d
--- /dev/null
@@ -0,0 +1 @@
+{results -> f:format.json() -> f:format.raw()}
\ No newline at end of file
index e2f1aaa..4ea1fed 100644 (file)
@@ -267,6 +267,13 @@ page {
                                sys_language_content.data = context:language:contentId
                                sys_language_contentOL.data = context:language:legacyOverlayType
                        }
+                       languageInfo.children {
+                               id.data = context:language:id
+                               contentId.data = context:language:contentId
+                               fallbackType.data = sitelanguage:fallbackType
+                               fallbackChain.data = context:language:fallbackChain
+                               overlayType.data = context:language:overlayType
+                       }
                }
                stdWrap.postUserFunc.as = Scope
        }
diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PageError.txt b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PageError.txt
new file mode 100644 (file)
index 0000000..1def3d5
--- /dev/null
@@ -0,0 +1,2 @@
+url: ###CURRENT_URL###
+reason: ###REASON###
diff --git a/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PhpError.php b/typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PhpError.php
new file mode 100644 (file)
index 0000000..8527bec
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Core\Tests\Functional\Fixtures\Frontend;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use Psr\Http\Message\ResponseInterface;
+use Psr\Http\Message\ServerRequestInterface;
+use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface;
+use TYPO3\CMS\Core\Http\JsonResponse;
+
+/**
+ * Test case for frontend requests without having site handling configured
+ */
+class PhpError implements PageErrorHandlerInterface
+{
+    /**
+     * @var int
+     */
+    private $statusCode;
+
+    /**
+     * @var array
+     */
+    private $configuration;
+
+    /**
+     * @param int $statusCode
+     * @param array $configuration
+     */
+    public function __construct(int $statusCode, array $configuration)
+    {
+        $this->statusCode = $statusCode;
+        $this->configuration = $configuration;
+    }
+
+    /**
+     * @param ServerRequestInterface $request
+     * @param string $message
+     * @param array $reasons
+     * @return ResponseInterface
+     */
+    public function handlePageError(
+        ServerRequestInterface $request,
+        string $message,
+        array $reasons = []
+    ): ResponseInterface {
+        $data = [
+            'uri' => (string)$request->getUri(),
+            'message' => $message,
+            'reasons' => $reasons,
+        ];
+        return new JsonResponse($data, $this->statusCode);
+    }
+}
diff --git a/typo3/sysext/core/Tests/Functional/SiteHandling/SiteBasedTestTrait.php b/typo3/sysext/core/Tests/Functional/SiteHandling/SiteBasedTestTrait.php
new file mode 100644 (file)
index 0000000..d53cfac
--- /dev/null
@@ -0,0 +1,212 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Core\Tests\Functional\SiteHandling;
+
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+use TYPO3\CMS\Core\Configuration\SiteConfiguration;
+use TYPO3\CMS\Core\Tests\Functional\Fixtures\Frontend\PhpError;
+
+/**
+ * Trait used for test classes that want to set up (= write) site configuration files.
+ *
+ * Mainly used when testing Site-related tests in Frontend requests.
+ *
+ * Be sure to set the LANGUAGE_PRESETS const in your class.
+ */
+trait SiteBasedTestTrait
+{
+    /**
+     * @param string $identifier
+     * @param array $site
+     * @param array $languages
+     * @param array $errorHandling
+     */
+    protected function writeSiteConfiguration(
+        string $identifier,
+        array $site = [],
+        array $languages = [],
+        array $errorHandling = []
+    ) {
+        $configuration = $site;
+        if (!empty($languages)) {
+            $configuration['languages'] = $languages;
+        }
+        if (!empty($errorHandling)) {
+            $configuration['errorHandling'] = $errorHandling;
+        }
+
+        $siteConfiguration = new SiteConfiguration(
+            $this->instancePath . '/typo3conf/sites/'
+        );
+
+        try {
+            $siteConfiguration->write($identifier, $configuration);
+        } catch (\Exception $exception) {
+            $this->markTestSkipped($exception->getMessage());
+        }
+    }
+
+    /**
+     * @param string $identifier
+     * @param array $overrides
+     */
+    protected function mergeSiteConfiguration(
+        string $identifier,
+        array $overrides
+    ) {
+        $siteConfiguration = new SiteConfiguration(
+            $this->instancePath . '/typo3conf/sites/'
+        );
+        $configuration = $siteConfiguration->load($identifier);
+        $configuration = array_merge($configuration, $overrides);
+        try {
+            $siteConfiguration->write($identifier, $configuration);
+        } catch (\Exception $exception) {
+            $this->markTestSkipped($exception->getMessage());
+        }
+    }
+
+    /**
+     * @param int $rootPageId
+     * @param string $base
+     * @return array
+     */
+    protected function buildSiteConfiguration(
+        int $rootPageId,
+        string $base = ''
+    ): array {
+        return [
+            'rootPageId' => $rootPageId,
+            'base' => $base,
+        ];
+    }
+
+    /**
+     * @param string $identifier
+     * @param string $base
+     * @return array
+     */
+    protected function buildDefaultLanguageConfiguration(
+        string $identifier,
+        string $base
+    ): array {
+        $configuration = $this->buildLanguageConfiguration($identifier, $base);
+        $configuration['typo3Language'] = 'default';
+        $configuration['flag'] = 'global';
+        unset($configuration['fallbackType'], $configuration['fallbacks']);
+        return $configuration;
+    }
+
+    /**
+     * @param string $identifier
+     * @param string $base
+     * @param array $fallbackIdentifiers
+     * @param string $fallbackType
+     * @return array
+     */
+    protected function buildLanguageConfiguration(
+        string $identifier,
+        string $base,
+        array $fallbackIdentifiers = [],
+        string $fallbackType = null
+    ): array {
+        $preset = $this->resolveLanguagePreset($identifier);
+
+        $configuration = [
+            'languageId' => $preset['id'],
+            'title' => $preset['title'],
+            'navigationTitle' => $preset['title'],
+            'base' => $base,
+            'locale' => $preset['locale'],
+            'iso-639-1' => $preset['iso'],
+            'hreflang' => $preset['hrefLang'],
+            'direction' => $preset['direction'],
+            'typo3Language' => $preset['iso'],
+            'flag' => $preset['iso'],
+            'fallbackType' => $fallbackType ?? (empty($fallbackIdentifiers) ? 'strict' : 'fallback'),
+        ];
+
+        if (!empty($fallbackIdentifiers)) {
+            $fallbackIds = array_map(
+                function (string $fallbackIdentifier) {
+                    $preset = $this->resolveLanguagePreset($fallbackIdentifier);
+                    return $preset['id'];
+                },
+                $fallbackIdentifiers
+            );
+            $configuration['fallbackType'] = $fallbackType ?? 'fallback';
+            $configuration['fallbacks'] = implode(',', $fallbackIds);
+        }
+
+        return $configuration;
+    }
+
+    /**
+     * @param string $handler
+     * @param array $codes
+     * @return array
+     */
+    protected function buildErrorHandlingConfiguration(
+        string $handler,
+        array $codes
+    ): array {
+        if ($handler === 'Page') {
+            $baseConfiguration = [
+                'errorContentSource' => '404',
+            ];
+        } elseif ($handler === 'Fluid') {
+            $baseConfiguration = [
+                'errorFluidTemplate' => 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidError.html',
+                'errorFluidTemplatesRootPath' => '',
+                'errorFluidLayoutsRootPath' => '',
+                'errorFluidPartialsRootPath' => '',
+            ];
+        } elseif ($handler === 'PHP') {
+            $baseConfiguration = [
+                'errorPhpClassFQCN' => PhpError::class,
+            ];
+        } else {
+            throw new \LogicException(
+                sprintf('Invalid handler "%s"', $handler),
+                1533894782
+            );
+        }
+
+        $baseConfiguration['errorHandler'] = $handler;
+
+        return array_map(
+            function (int $code) use ($baseConfiguration) {
+                $baseConfiguration['errorCode'] = $code;
+                return $baseConfiguration;
+            },
+            $codes
+        );
+    }
+
+    /**
+     * @param string $identifier
+     * @return mixed
+     */
+    protected function resolveLanguagePreset(string $identifier)
+    {
+        if (!isset(static::LANGUAGE_PRESETS[$identifier])) {
+            throw new \LogicException(
+                sprintf('Undefined preset identifier "%s"', $identifier),
+                1533893665
+            );
+        }
+        return static::LANGUAGE_PRESETS[$identifier];
+    }
+}
index 21b60c9..b59772e 100644 (file)
@@ -1,7 +1,7 @@
-"pages",,,,,,,,,,,,,,
-,"uid","pid","sorting","deleted","sys_language_uid","l10n_parent","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","t3ver_move_id","title","l10n_state"
-,1,0,256,0,0,0,0,0,0,0,0,0,"Root page","{}"
-,88,1,256,0,0,0,0,0,0,0,0,0,"Subpage","{}"
-,89,88,256,0,0,0,0,0,0,0,0,0,"Default language Page","{}"
-,90,88,256,0,1,89,0,0,0,0,0,0,"[DK]Page","{""title"":""parent""}"
-,91,88,256,0,3,89,0,0,0,0,0,0,"[PL]Page","{""title"":""parent""}"
+"pages",,,,,,,,,,,,,,,
+,"uid","pid","sorting","deleted","sys_language_uid","l10n_parent","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","t3ver_move_id","title","slug","l10n_state"
+,1,0,256,0,0,0,0,0,0,0,0,0,"Root page","/","{}"
+,88,1,256,0,0,0,0,0,0,0,0,0,"Subpage","/subpage/","{}"
+,89,88,256,0,0,0,0,0,0,0,0,0,"Default language Page","/subpage/default-language-page/","{}"
+,90,88,256,0,1,89,0,0,0,0,0,0,"[DK]Page","/subpage/dk-page/","{""title"":""parent""}"
+,91,88,256,0,3,89,0,0,0,0,0,0,"[PL]Page","/subpage/pl-page/","{""title"":""parent""}"
index 085b575..d147985 100644 (file)
@@ -15,11 +15,10 @@ namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Core\Configuration\SiteConfiguration;
+use TYPO3\CMS\Core\Tests\Functional\SiteHandling\SiteBasedTestTrait;
 use TYPO3\CMS\Core\Utility\ArrayUtility;
 use TYPO3\CMS\Frontend\Page\CacheHashCalculator;
 use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Fixtures\LinkHandlingController;
-use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Fixtures\PhpError;
 use TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Internal\ArrayValueInstruction;
 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
 
@@ -28,6 +27,8 @@ use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
  */
 abstract class AbstractTestCase extends FunctionalTestCase
 {
+    use SiteBasedTestTrait;
+
     protected const ENCRYPTION_KEY = '4408d27a916d51e624b69af3554f516dbab61037a9f7b9fd6f81b4d3bedeccb6';
 
     protected const TYPO3_CONF_VARS = [
@@ -170,187 +171,6 @@ abstract class AbstractTestCase extends FunctionalTestCase
     }
 
     /**
-     * @param string $identifier
-     * @param array $site
-     * @param array $languages
-     * @param array $errorHandling
-     */
-    protected function writeSiteConfiguration(
-        string $identifier,
-        array $site = [],
-        array $languages = [],
-        array $errorHandling = []
-    ) {
-        $configuration = $site;
-        if (!empty($languages)) {
-            $configuration['languages'] = $languages;
-        }
-        if (!empty($errorHandling)) {
-            $configuration['errorHandling'] = $errorHandling;
-        }
-
-        $siteConfiguration = new SiteConfiguration(
-            $this->instancePath . '/typo3conf/sites/'
-        );
-
-        try {
-            $siteConfiguration->write($identifier, $configuration);
-        } catch (\Exception $exception) {
-            $this->markTestSkipped($exception->getMessage());
-        }
-    }
-
-    /**
-     * @param string $identifier
-     * @param array $overrides
-     */
-    protected function mergeSiteConfiguration(
-        string $identifier,
-        array $overrides
-    ) {
-        $siteConfiguration = new SiteConfiguration(
-            $this->instancePath . '/typo3conf/sites/'
-        );
-        $configuration = $siteConfiguration->load($identifier);
-        $configuration = array_merge($configuration, $overrides);
-        try {
-            $siteConfiguration->write($identifier, $configuration);
-        } catch (\Exception $exception) {
-            $this->markTestSkipped($exception->getMessage());
-        }
-    }
-
-    /**
-     * @param int $rootPageId
-     * @param string $base
-     * @return array
-     */
-    protected function buildSiteConfiguration(
-        int $rootPageId,
-        string $base = ''
-    ): array {
-        return [
-            'rootPageId' => $rootPageId,
-            'base' => $base,
-        ];
-    }
-
-    /**
-     * @param string $identifier
-     * @param string $base
-     * @return array
-     */
-    protected function buildDefaultLanguageConfiguration(
-        string $identifier,
-        string $base
-    ): array {
-        $configuration = $this->buildLanguageConfiguration($identifier, $base);
-        $configuration['typo3Language'] = 'default';
-        $configuration['flag'] = 'global';
-        unset($configuration['fallbackType'], $configuration['fallbacks']);
-        return $configuration;
-    }
-
-    /**
-     * @param string $identifier
-     * @param string $base
-     * @param array $fallbackIdentifiers
-     * @return array
-     */
-    protected function buildLanguageConfiguration(
-        string $identifier,
-        string $base,
-        array $fallbackIdentifiers = []
-    ): array {
-        $preset = $this->resolveLanguagePreset($identifier);
-
-        $configuration = [
-            'languageId' => $preset['id'],
-            'title' => $preset['title'],
-            'navigationTitle' => $preset['title'],
-            'base' => $base,
-            'locale' => $preset['locale'],
-            'iso-639-1' => $preset['iso'],
-            'hreflang' => $preset['hrefLang'],
-            'direction' => $preset['direction'],
-            'typo3Language' => $preset['iso'],
-            'flag' => $preset['iso'],
-            'fallbackType' => 'strict',
-        ];
-
-        if (!empty($fallbackIdentifiers)) {
-            $fallbackIds = array_map(
-                function (string $fallbackIdentifier) {
-                    $preset = $this->resolveLanguagePreset($fallbackIdentifier);
-                    return $preset['id'];
-                },
-                $fallbackIdentifiers
-            );
-            $configuration['fallbackType'] = 'fallback';
-            $configuration['fallbacks'] = implode(',', $fallbackIds);
-        }
-
-        return $configuration;
-    }
-
-    /**
-     * @param string $handler
-     * @param array $codes
-     * @return array
-     */
-    protected function buildErrorHandlingConfiguration(
-        string $handler,
-        array $codes
-    ): array {
-        if ($handler === 'Page') {
-            $baseConfiguration = [
-                'errorContentSource' => '404',
-            ];
-        } elseif ($handler === 'Fluid') {
-            $baseConfiguration = [
-                'errorFluidTemplate' => 'typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidError.html',
-                'errorFluidTemplatesRootPath' => '',
-                'errorFluidLayoutsRootPath' => '',
-                'errorFluidPartialsRootPath' => '',
-            ];
-        } elseif ($handler === 'PHP') {
-            $baseConfiguration = [
-                'errorPhpClassFQCN' => PhpError::class,
-            ];
-        } else {
-            throw new \LogicException(
-                sprintf('Invalid handler "%s"', $handler),
-                1533894782
-            );
-        }
-
-        $baseConfiguration['errorHandler'] = $handler;
-
-        return array_map(
-            function (int $code) use ($baseConfiguration) {
-                $baseConfiguration['errorCode'] = $code;
-                return $baseConfiguration;
-            },
-            $codes
-        );
-    }
-
-    /**
-     * @param string $identifier
-     * @return mixed
-     */
-    protected function resolveLanguagePreset(string $identifier)
-    {
-        if (!isset(static::LANGUAGE_PRESETS[$identifier])) {
-            throw new \LogicException(
-                sprintf('Undefined preset identifier "%s"', $identifier),
-                1533893665
-            );
-        }
-        return static::LANGUAGE_PRESETS[$identifier];
-    }
-
-    /**
      * @param string $uri
      * @return string
      */
@@ -404,7 +224,7 @@ abstract class AbstractTestCase extends FunctionalTestCase
             ->withArray([
                 '10' => 'FLUIDTEMPLATE',
                 '10.' => [
-                    'file' => 'typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidJson.html',
+                    'file' => 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidJson.html',
                     'dataProcessing.' => [
                         '1' => 'TYPO3\\CMS\\Frontend\\DataProcessing\\MenuProcessor',
                         '1.' => array_merge(
@@ -426,7 +246,7 @@ abstract class AbstractTestCase extends FunctionalTestCase
             ->withArray([
                 '10' => 'FLUIDTEMPLATE',
                 '10.' => [
-                    'file' => 'typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidJson.html',
+                    'file' => 'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/FluidJson.html',
                     'dataProcessing.' => [
                         '1' => 'TYPO3\\CMS\\Frontend\\DataProcessing\\LanguageMenuProcessor',
                         '1.' => array_merge(
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidError.html b/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidError.html
deleted file mode 100644 (file)
index 4ed80f2..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-uri: {request.uri}
-message: {message}
-reasons: <f:for each="{reasons}" as="reason" key="key">{key},</f:for>
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidJson.html b/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/FluidJson.html
deleted file mode 100644 (file)
index 34e988d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-{results -> f:format.json() -> f:format.raw()}
\ No newline at end of file
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PageError.txt b/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PageError.txt
deleted file mode 100644 (file)
index 1def3d5..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-url: ###CURRENT_URL###
-reason: ###REASON###
diff --git a/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PhpError.php b/typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PhpError.php
deleted file mode 100644 (file)
index 781390a..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Fixtures;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use Psr\Http\Message\ResponseInterface;
-use Psr\Http\Message\ServerRequestInterface;
-use TYPO3\CMS\Core\Error\PageErrorHandler\PageErrorHandlerInterface;
-use TYPO3\CMS\Core\Http\JsonResponse;
-
-/**
- * Test case for frontend requests without having site handling configured
- */
-class PhpError implements PageErrorHandlerInterface
-{
-    /**
-     * @var int
-     */
-    private $statusCode;
-
-    /**
-     * @var array
-     */
-    private $configuration;
-
-    /**
-     * @param int $statusCode
-     * @param array $configuration
-     */
-    public function __construct(int $statusCode, array $configuration)
-    {
-        $this->statusCode = $statusCode;
-        $this->configuration = $configuration;
-    }
-
-    /**
-     * @param ServerRequestInterface $request
-     * @param string $message
-     * @param array $reasons
-     * @return ResponseInterface
-     */
-    public function handlePageError(
-        ServerRequestInterface $request,
-        string $message,
-        array $reasons = []
-    ): ResponseInterface {
-        $data = [
-            'uri' => (string)$request->getUri(),
-            'message' => $message,
-            'reasons' => $reasons,
-        ];
-        return new JsonResponse($data, $this->statusCode);
-    }
-}
index 123655d..a0e6eab 100644 (file)
@@ -427,7 +427,7 @@ class PlainRequestTest extends AbstractTestCase
                 ->withMergedGlobalSettings([
                     'TYPO3_CONF_VARS' => [
                         'FE' => [
-                            'pageNotFound_handling' => 'READFILE:typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PageError.txt',
+                            'pageNotFound_handling' => 'READFILE:typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PageError.txt',
                         ]
                     ]
                 ])
@@ -507,7 +507,7 @@ class PlainRequestTest extends AbstractTestCase
             $this->internalRequestContext->withMergedGlobalSettings([
                 'TYPO3_CONF_VARS' => [
                     'FE' => [
-                        'pageNotFound_handling' => 'READFILE:typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PageError.txt',
+                        'pageNotFound_handling' => 'READFILE:typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PageError.txt',
                     ]
                 ]
             ])
index 0b4318a..dd24b3f 100644 (file)
@@ -636,7 +636,7 @@ class SiteRequestTest extends AbstractTestCase
             $this->internalRequestContext->withMergedGlobalSettings([
                 'TYPO3_CONF_VARS' => [
                     'FE' => [
-                        'pageNotFound_handling' => 'READFILE:typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PageError.txt',
+                        'pageNotFound_handling' => 'READFILE:typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PageError.txt',
                     ]
                 ]
             ])
index a2d4243..d613db5 100644 (file)
@@ -751,7 +751,7 @@ class SlugSiteRequestTest extends AbstractTestCase
             $this->internalRequestContext->withMergedGlobalSettings([
                 'TYPO3_CONF_VARS' => [
                     'FE' => [
-                        'pageNotFound_handling' => 'READFILE:typo3/sysext/frontend/Tests/Functional/SiteHandling/Fixtures/PageError.txt',
+                        'pageNotFound_handling' => 'READFILE:typo3/sysext/core/Tests/Functional/Fixtures/Frontend/PageError.txt',
                     ]
                 ]
             ])
index 52322ad..4ccbbc5 100644 (file)
@@ -26,8 +26,8 @@ use TYPO3\CMS\Core\Http\Uri;
 use TYPO3\CMS\Core\Routing\SiteRouteResult;
 use TYPO3\CMS\Core\Site\Entity\Site;
 use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
+use TYPO3\CMS\Core\Tests\Functional\Fixtures\Frontend\PhpError;
 use TYPO3\CMS\Frontend\Middleware\SiteBaseRedirectResolver;
-use TYPO3\CMS\Frontend\Tests\Functional\SiteHandling\Fixtures\PhpError;
 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 class SiteBaseRedirectResolverTest extends UnitTestCase