[TASK] Remove deprecated code from TypoScript condition matchers 91/59491/11
authorFrank Naegler <frank.naegler@typo3.org>
Fri, 18 Jan 2019 08:27:09 +0000 (09:27 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 1 Feb 2019 15:41:32 +0000 (16:41 +0100)
Resolves: #87607
Related: #87193
Releases: master
Change-Id: I5c1ce876cd6ad5edeecefce03d7a1e3619f9d54c
Reviewed-on: https://review.typo3.org/59491
Tested-by: TYPO3com <noreply@typo3.com>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
26 files changed:
typo3/sysext/backend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php
typo3/sysext/backend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php [new file with mode: 0644]
typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php [deleted file]
typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php [deleted file]
typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestCondition.php [deleted file]
typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestConditionException.php [deleted file]
typo3/sysext/core/Classes/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcher.php
typo3/sysext/core/Configuration/DefaultConfiguration.php
typo3/sysext/core/Configuration/DefaultConfigurationDescription.yaml
typo3/sysext/core/Documentation/Changelog/master/Breaking-87193-DeprecatedFunctionalityRemoved.rst
typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.typoscript
typo3/sysext/core/Tests/Unit/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcherTest.php
typo3/sysext/core/Tests/Unit/TypoScript/Parser/TypoScriptParserTest.php
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/Frontend/ContentJsonRenderer.typoscript
typo3/sysext/extbase/Tests/Functional/Persistence/Fixtures/Frontend/JsonRenderer.typoscript
typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test/Configuration/TypoScript/Basic.ts
typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test/Configuration/TypoScript/ExtbaseController.ts
typo3/sysext/fluid/Tests/Functional/Fixtures/Extensions/fluid_test/Configuration/TypoScript/ExtbasePlugin.ts
typo3/sysext/frontend/Classes/Configuration/TypoScript/ConditionMatching/ConditionMatcher.php
typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php [new file with mode: 0644]
typo3/sysext/frontend/Tests/Functional/Rendering/Fixtures/TitleTagRenderingTest.typoscript
typo3/sysext/frontend/Tests/Functional/Rendering/Fixtures/UriPrefixRenderingTest.typoscript
typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php [deleted file]
typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php [deleted file]
typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestCondition.php [deleted file]
typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestConditionException.php [deleted file]

index dfd2ad4..e972c28 100644 (file)
@@ -14,7 +14,6 @@ namespace TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching;
  * The TYPO3 project - inspiring people to share!
  */
 
-use TYPO3\CMS\Backend\Controller\EditDocumentController;
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher;
 use TYPO3\CMS\Core\Context\Context;
@@ -36,12 +35,11 @@ class ConditionMatcher extends AbstractConditionMatcher
 
     public function __construct(Context $context = null)
     {
+        $pageId = $this->pageId ?? $this->determinePageId();
+
         $this->context = $context ?? GeneralUtility::makeInstance(Context::class);
-        $this->rootline = $this->determineRootline() ?? [];
+        $this->rootline = BackendUtility::BEgetRootLine($pageId, '', true) ?? [];
         $treeLevel = $this->rootline ? count($this->rootline) - 1 : 0;
-        if ($this->isNewPageWithPageId($this->pageId)) {
-            $treeLevel++;
-        }
         $tree = new \stdClass();
         $tree->level = $treeLevel;
         $tree->rootLine = $this->rootline;
@@ -61,107 +59,12 @@ class ConditionMatcher extends AbstractConditionMatcher
             [
                 'tree' => $tree,
                 'backend' => $backend,
-                'page' => $this->getPage(),
+                'page' => BackendUtility::getRecord('pages', $pageId) ?? [],
             ]
         );
     }
 
     /**
-     * Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
-     *
-     * @param string $string The condition to match against its criteria.
-     * @return bool Whether the condition matched
-     * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::parse()
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function evaluateCondition($string)
-    {
-        if ($this->strictSyntaxEnabled()) {
-            trigger_error('The old condition syntax will be removed in TYPO3 v10.0, use the new expression language. Used condition: [' . $string . '].', E_USER_DEPRECATED);
-        }
-
-        list($key, $value) = GeneralUtility::trimExplode('=', $string, false, 2);
-        $result = $this->evaluateConditionCommon($key, $value);
-        if (is_bool($result)) {
-            return $result;
-        }
-
-        switch ($key) {
-                case 'usergroup':
-                    $groupList = $this->getGroupList();
-                    $values = GeneralUtility::trimExplode(',', $value, true);
-                    foreach ($values as $test) {
-                        if ($test === '*' || GeneralUtility::inList($groupList, $test)) {
-                            return true;
-                        }
-                    }
-                    break;
-                case 'adminUser':
-                    if ($this->isUserLoggedIn()) {
-                        return !((bool)$value xor $this->isAdminUser());
-                    }
-                    break;
-                case 'treeLevel':
-                    $values = GeneralUtility::trimExplode(',', $value, true);
-                    $treeLevel = count($this->rootline) - 1;
-                    // If a new page is being edited or saved the treeLevel is higher by one:
-                    if ($this->isNewPageWithPageId($this->pageId)) {
-                        $treeLevel++;
-                    }
-                    foreach ($values as $test) {
-                        if ($test == $treeLevel) {
-                            return true;
-                        }
-                    }
-                    break;
-                case 'PIDupinRootline':
-                case 'PIDinRootline':
-                    $values = GeneralUtility::trimExplode(',', $value, true);
-                    if ($key === 'PIDinRootline' || !in_array($this->pageId, $values) || $this->isNewPageWithPageId($this->pageId)) {
-                        foreach ($values as $test) {
-                            foreach ($this->rootline as $rl_dat) {
-                                if ($rl_dat['uid'] == $test) {
-                                    return true;
-                                }
-                            }
-                        }
-                    }
-                    break;
-                default:
-                    $conditionResult = $this->evaluateCustomDefinedCondition($string);
-                    if ($conditionResult !== null) {
-                        return $conditionResult;
-                    }
-            }
-
-        return false;
-    }
-
-    /**
-     * Returns GP / ENV vars
-     *
-     * @param string $var Identifier
-     * @return mixed The value of the variable pointed to or NULL if variable did not exist
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getVariable($var)
-    {
-        $vars = explode(':', $var, 2);
-        return $this->getVariableCommon($vars);
-    }
-
-    /**
-     * Get the usergroup list of the current user.
-     *
-     * @return string The usergroup list of the current user
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getGroupList()
-    {
-        return $this->getBackendUserAuthentication()->groupList;
-    }
-
-    /**
      * Tries to determine the ID of the page currently processed.
      * When User/Group TS-Config is parsed when no specific page is handled
      * (i.e. in the Extension Manager, etc.) this function will return "0", so that
@@ -205,18 +108,6 @@ class ConditionMatcher extends AbstractConditionMatcher
     }
 
     /**
-     * Gets the properties for the current page.
-     *
-     * @return array The properties for the current page.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getPage()
-    {
-        $pageId = $this->pageId ?? $this->determinePageId();
-        return BackendUtility::getRecord('pages', $pageId) ?? [];
-    }
-
-    /**
      * Gets the page id by a record.
      *
      * @param string $table Name of the table
@@ -239,98 +130,4 @@ class ConditionMatcher extends AbstractConditionMatcher
         }
         return $pageId;
     }
-
-    /**
-     * Determine if record of table 'pages' with the given $pid is currently created in TCEforms.
-     * This information is required for conditions in BE for PIDupinRootline.
-     *
-     * @param int $pageId The pid the check for as parent page
-     * @return bool TRUE if the is currently a new page record being edited with $pid as uid of the parent page
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function isNewPageWithPageId($pageId)
-    {
-        if (isset($GLOBALS['SOBE']) && $GLOBALS['SOBE'] instanceof EditDocumentController) {
-            $pageId = (int)$pageId;
-            $elementsData = $GLOBALS['SOBE']->elementsData;
-            $data = $GLOBALS['SOBE']->data;
-            // If saving a new page record:
-            if (is_array($data) && isset($data['pages']) && is_array($data['pages'])) {
-                foreach ($data['pages'] as $uid => $fields) {
-                    if (strpos($uid, 'NEW') === 0 && $fields['pid'] == $pageId) {
-                        return true;
-                    }
-                }
-            }
-            // If editing a new page record (not saved yet):
-            if (is_array($elementsData)) {
-                foreach ($elementsData as $element) {
-                    if ($element['cmd'] === 'new' && $element['table'] === 'pages') {
-                        if ($element['pid'] < 0) {
-                            $pageRecord = BackendUtility::getRecord('pages', abs($element['pid']), 'pid');
-                            $element['pid'] = $pageRecord['pid'];
-                        }
-                        if ($element['pid'] == $pageId) {
-                            return true;
-                        }
-                    }
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Determines the rootline for the current page.
-     *
-     * @return array The rootline for the current page.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function determineRootline()
-    {
-        $pageId = $this->pageId ?? $this->determinePageId();
-        return BackendUtility::BEgetRootLine($pageId, '', true);
-    }
-
-    /**
-     * Get the id of the current user.
-     *
-     * @return int The id of the current user
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getUserId()
-    {
-        return $this->getBackendUserAuthentication()->user['uid'];
-    }
-
-    /**
-     * Determines if a user is logged in.
-     *
-     * @return bool Determines if a user is logged in
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function isUserLoggedIn()
-    {
-        return (bool)$this->getBackendUserAuthentication()->user['uid'];
-    }
-
-    /**
-     * Determines whether the current user is admin.
-     *
-     * @return bool Whether the current user is admin
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function isAdminUser()
-    {
-        return $this->getBackendUserAuthentication()->isAdmin();
-    }
-
-    /**
-     * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getBackendUserAuthentication()
-    {
-        return $GLOBALS['BE_USER'] ?? null;
-    }
 }
diff --git a/typo3/sysext/backend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/backend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
new file mode 100644 (file)
index 0000000..632efa5
--- /dev/null
@@ -0,0 +1,279 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Backend\Tests\Functional\Configuration\TypoScript\ConditionMatching;
+
+/*
+ * 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\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
+use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Context\Context;
+use TYPO3\CMS\Core\Context\UserAspect;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
+/**
+ * Functional test for the ConditionMatcher of EXT:backend
+ */
+class ConditionMatcherTest extends FunctionalTestCase
+{
+    /**
+     * @var ConditionMatcher|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
+     */
+    protected $subject;
+
+    /**
+     * Sets up this test case.
+     */
+    protected function setUp(): void
+    {
+        parent::setUp();
+
+        $this->importDataSet('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
+
+        $backendUser = new BackendUserAuthentication();
+        $backendUser->user['uid'] = 13;
+        $backendUser->user['admin'] = true;
+        $backendUser->groupList = '13,14,15';
+        GeneralUtility::makeInstance(Context::class)->setAspect('backend.user', new UserAspect($backendUser));
+
+        $this->subject = new ConditionMatcher();
+    }
+
+    /**
+     * Tests whether usergroup comparison matches.
+     *
+     * @test
+     */
+    public function usergroupConditionMatchesSingleGroupId(): void
+    {
+        $this->assertTrue($this->subject->match('[usergroup(13)]'));
+        $this->assertTrue($this->subject->match('[usergroup("13")]'));
+        $this->assertTrue($this->subject->match('[usergroup(\'13\')]'));
+    }
+
+    /**
+     * Tests whether usergroup comparison matches.
+     *
+     * @test
+     */
+    public function usergroupConditionMatchesMultipleUserGroupId(): void
+    {
+        $this->assertTrue($this->subject->match('[usergroup("999,15,14,13")]'));
+        $this->assertTrue($this->subject->match('[usergroup(\'999,15,14,13\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionMatchesAnyLoggedInUser(): void
+    {
+        $this->assertTrue($this->subject->match('[loginUser("*")]'));
+        $this->assertTrue($this->subject->match('[loginUser(\'*\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionMatchesSingleLoggedInUser(): void
+    {
+        $this->assertTrue($this->subject->match('[loginUser(13)]'));
+        $this->assertTrue($this->subject->match('[loginUser("13")]'));
+        $this->assertTrue($this->subject->match('[loginUser(\'13\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionDoesNotMatchSingleLoggedInUser(): void
+    {
+        $GLOBALS['BE_USER']->user['uid'] = 13;
+        $this->assertFalse($this->subject->match('[loginUser(999)]'));
+        $this->assertFalse($this->subject->match('[loginUser("999")]'));
+        $this->assertFalse($this->subject->match('[loginUser(\'999\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionMatchesMultipleLoggedInUsers(): void
+    {
+        $this->assertTrue($this->subject->match('[loginUser("999,13")]'));
+        $this->assertTrue($this->subject->match('[loginUser(\'999,13\')]'));
+    }
+
+    /**
+     * Tests whether checkinf for an admin user matches
+     *
+     * @test
+     */
+    public function adminUserConditionMatchesAdminUser(): void
+    {
+        $this->assertTrue($this->subject->match('[backend.user.isAdmin == true]'));
+        $this->assertTrue($this->subject->match('[backend.user.isAdmin != false]'));
+        $this->assertTrue($this->subject->match('[backend.user.isAdmin]'));
+    }
+
+    /**
+     * Tests whether treeLevel comparison matches.
+     *
+     * @test
+     */
+    public function treeLevelConditionMatchesSingleValue(): void
+    {
+        $this->subject->setPageId(2);
+        $this->subject->__construct();
+        $this->assertTrue($this->subject->match('[tree.level == 2]'));
+    }
+
+    /**
+     * Tests whether treeLevel comparison matches.
+     *
+     * @test
+     */
+    public function treeLevelConditionMatchesMultipleValues(): void
+    {
+        $this->subject->setPageId(2);
+        $this->subject->__construct();
+        $this->assertTrue($this->subject->match('[tree.level in [999,998,2]]'));
+    }
+
+    /**
+     * Tests whether treeLevel comparison matches.
+     *
+     * @test
+     */
+    public function treeLevelConditionDoesNotMatchFaultyValue(): void
+    {
+        $this->assertFalse($this->subject->match('[tree.level == 999]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in the previous rootline entries.
+     *
+     * @test
+     */
+    public function PIDupinRootlineConditionMatchesSinglePageIdInRootline(): void
+    {
+        $this->subject->setPageId(3);
+        $this->subject->__construct();
+        $this->assertTrue($this->subject->match('[2 in tree.rootLineIds]'));
+        $this->assertTrue($this->subject->match('["2" in tree.rootLineIds]'));
+        $this->assertTrue($this->subject->match('[\'2\' in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in the previous rootline entries.
+     *
+     * @test
+     */
+    public function PIDupinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
+    {
+        $this->subject->setPageId(3);
+        $this->assertFalse($this->subject->match('[999 in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in all rootline entries.
+     *
+     * @test
+     */
+    public function PIDinRootlineConditionMatchesSinglePageIdInRootline(): void
+    {
+        $this->subject->setPageId(3);
+        $this->subject->__construct();
+        $this->assertTrue($this->subject->match('[2 in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in all rootline entries.
+     *
+     * @test
+     */
+    public function PIDinRootlineConditionMatchesLastPageIdInRootline(): void
+    {
+        $this->subject->setPageId(3);
+        $this->subject->__construct();
+        $this->assertTrue($this->subject->match('[3 in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in all rootline entries.
+     *
+     * @test
+     */
+    public function PIDinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
+    {
+        $this->subject->setPageId(3);
+        $this->assertFalse($this->subject->match('[999 in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether the compatibility version can be evaluated.
+     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
+     *
+     * @test
+     */
+    public function compatVersionConditionMatchesOlderRelease(): void
+    {
+        $this->assertTrue($this->subject->match('[compatVersion(7.0)]'));
+        $this->assertTrue($this->subject->match('[compatVersion("7.0")]'));
+        $this->assertTrue($this->subject->match('[compatVersion(\'7.0\')]'));
+    }
+
+    /**
+     * Tests whether the compatibility version can be evaluated.
+     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
+     *
+     * @test
+     */
+    public function compatVersionConditionMatchesSameRelease(): void
+    {
+        $this->assertTrue($this->subject->match('[compatVersion(' . TYPO3_branch . ')]'));
+        $this->assertTrue($this->subject->match('[compatVersion("' . TYPO3_branch . '")]'));
+        $this->assertTrue($this->subject->match('[compatVersion(\'' . TYPO3_branch . '\')]'));
+    }
+
+    /**
+     * Tests whether the compatibility version can be evaluated.
+     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
+     *
+     * @test
+     */
+    public function compatVersionConditionDoesNotMatchNewerRelease(): void
+    {
+        $this->assertFalse($this->subject->match('[compatVersion(15.0)]'));
+        $this->assertFalse($this->subject->match('[compatVersion("15.0")]'));
+        $this->assertFalse($this->subject->match('[compatVersion(\'15.0\')]'));
+    }
+
+    /**
+     * Tests whether the generic fetching of variables works with the namespace 'ENV'.
+     *
+     * @test
+     */
+    public function genericGetVariablesSucceedsWithNamespaceENV(): void
+    {
+        $testKey = $this->getUniqueId('test');
+        putenv($testKey . '=testValue');
+        $this->assertTrue($this->subject->match('[getenv("' . $testKey . '") == "testValue"]'));
+    }
+}
diff --git a/typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/backend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
deleted file mode 100644 (file)
index 5e05cd5..0000000
+++ /dev/null
@@ -1,365 +0,0 @@
-<?php
-namespace TYPO3\CMS\Backend\Tests\Unit\Configuration\TypoScript\ConditionMatching;
-
-/*
- * 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 Prophecy\Argument;
-use TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
-use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
-use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
-use TYPO3\CMS\Core\Context\Context;
-use TYPO3\CMS\Core\Context\UserAspect;
-use TYPO3\CMS\Core\Http\ServerRequest;
-use TYPO3\CMS\Core\Log\Logger;
-use TYPO3\CMS\Core\Package\PackageInterface;
-use TYPO3\CMS\Core\Package\PackageManager;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-/**
- * Testcase for class \TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher.
- */
-class ConditionMatcherTest extends UnitTestCase
-{
-    /**
-     * @var array
-     */
-    protected $rootline;
-
-    /**
-     * @var \TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher
-     */
-    protected $matchCondition;
-
-    /**
-     * @var string
-     */
-    protected $testGlobalNamespace;
-
-    /**
-     * @var string
-     */
-    protected $testTableName;
-
-    /**
-     * @var bool Reset singletons
-     */
-    protected $resetSingletonInstances = true;
-
-    /**
-     * Set up tests
-     */
-    protected function setUp()
-    {
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
-        $cacheFrontendProphecy->has(Argument::any())->willReturn(false);
-        $cacheFrontendProphecy->set(Argument::any(), Argument::any())->willReturn(null);
-        $cacheManagerProphecy = $this->prophesize(CacheManager::class);
-        $cacheManagerProphecy->getCache('cache_core')->willReturn($cacheFrontendProphecy->reveal());
-        GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
-
-        $packageManagerProphecy = $this->prophesize(PackageManager::class);
-        $corePackageProphecy = $this->prophesize(PackageInterface::class);
-        $corePackageProphecy->getPackagePath()->willReturn(__DIR__ . '/../../../../../../../sysext/core/');
-        $packageManagerProphecy->getActivePackages()->willReturn([
-            $corePackageProphecy->reveal()
-        ]);
-        GeneralUtility::setSingletonInstance(PackageManager::class, $packageManagerProphecy->reveal());
-
-        $this->testTableName = 'conditionMatcherTestTable';
-        $this->testGlobalNamespace = $this->getUniqueId('TEST');
-        $GLOBALS['TCA'][$this->testTableName] = ['ctrl' => []];
-        $GLOBALS[$this->testGlobalNamespace] = [];
-        $this->setUpBackend();
-        $this->matchCondition = $this->getAccessibleMock(ConditionMatcher::class, ['determineRootline'], [], '', false);
-        $this->matchCondition->method('determineRootline')->willReturn([
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ]);
-        $this->matchCondition->__construct();
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $this->matchCondition->setLogger($loggerProphecy->reveal());
-    }
-
-    /**
-     * Set up a backend
-     */
-    private function setUpBackend()
-    {
-        $this->rootline = [
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ];
-        $GLOBALS['BE_USER'] = $this->getMockBuilder(BackendUserAuthentication::class)
-            ->setMethods(['dummy'])
-            ->disableOriginalConstructor()
-            ->getMock();
-        $GLOBALS['BE_USER']->groupList = '13,14,15';
-        $GLOBALS['BE_USER']->user['uid'] = 13;
-        $GLOBALS['BE_USER']->user['admin'] = 1;
-
-        GeneralUtility::makeInstance(Context::class)
-            ->setAspect('backend.user', new UserAspect($GLOBALS['BE_USER']));
-    }
-
-    /**
-     * Set up database mock
-     */
-    private function setUpDatabaseMockForDeterminePageId()
-    {
-        $this->matchCondition = $this->getAccessibleMock(ConditionMatcher::class, ['determineRootline', 'determinePageId'], [], '', false);
-        $this->matchCondition->method('determineRootline')->willReturn([
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ]);
-        $this->matchCondition->__construct();
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $this->matchCondition->setLogger($loggerProphecy->reveal());
-
-        $this->matchCondition->expects($this->once())->method('determinePageId')->willReturn(999);
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesSingleGroupId()
-    {
-        $this->assertTrue($this->matchCondition->match('[usergroup(13)]'));
-        $this->assertTrue($this->matchCondition->match('[usergroup("13")]'));
-        $this->assertTrue($this->matchCondition->match('[usergroup(\'13\')]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesMultipleUserGroupId()
-    {
-        $this->assertTrue($this->matchCondition->match('[usergroup("999,15,14,13")]'));
-        $this->assertTrue($this->matchCondition->match('[usergroup(\'999,15,14,13\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesAnyLoggedInUser()
-    {
-        $this->assertTrue($this->matchCondition->match('[loginUser("*")]'));
-        $this->assertTrue($this->matchCondition->match('[loginUser(\'*\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesSingleLoggedInUser()
-    {
-        $this->assertTrue($this->matchCondition->match('[loginUser(13)]'));
-        $this->assertTrue($this->matchCondition->match('[loginUser("13")]'));
-        $this->assertTrue($this->matchCondition->match('[loginUser(\'13\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionDoesNotMatchSingleLoggedInUser()
-    {
-        $GLOBALS['BE_USER']->user['uid'] = 13;
-        $this->assertFalse($this->matchCondition->match('[loginUser(999)]'));
-        $this->assertFalse($this->matchCondition->match('[loginUser("999")]'));
-        $this->assertFalse($this->matchCondition->match('[loginUser(\'999\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesMultipleLoggedInUsers()
-    {
-        $this->assertTrue($this->matchCondition->match('[loginUser("999,13")]'));
-        $this->assertTrue($this->matchCondition->match('[loginUser(\'999,13\')]'));
-    }
-
-    /**
-     * Tests whether checkinf for an admin user matches
-     *
-     * @test
-     */
-    public function adminUserConditionMatchesAdminUser()
-    {
-        $this->assertTrue($this->matchCondition->match('[backend.user.isAdmin == true]'));
-        $this->assertTrue($this->matchCondition->match('[backend.user.isAdmin != false]'));
-        $this->assertTrue($this->matchCondition->match('[backend.user.isAdmin]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesSingleValue()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->assertTrue($this->matchCondition->match('[tree.level == 2]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesMultipleValues()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->assertTrue($this->matchCondition->match('[tree.level in [999,998,2]]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionDoesNotMatchFaultyValue()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->assertFalse($this->matchCondition->match('[tree.level == 999]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesSinglePageIdInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[111 in tree.rootLineIds]'));
-        $this->assertTrue($this->matchCondition->match('["111" in tree.rootLineIds]'));
-        $this->assertTrue($this->matchCondition->match('[\'111\' in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionDoesNotMatchPageIdNotInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertFalse($this->matchCondition->match('[999 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesSinglePageIdInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[111 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesLastPageIdInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[121 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionDoesNotMatchPageIdNotInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertFalse($this->matchCondition->match('[999 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesOlderRelease()
-    {
-        $this->assertTrue($this->matchCondition->match('[compatVersion(7.0)]'));
-        $this->assertTrue($this->matchCondition->match('[compatVersion("7.0")]'));
-        $this->assertTrue($this->matchCondition->match('[compatVersion(\'7.0\')]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesSameRelease()
-    {
-        $this->assertTrue($this->matchCondition->match('[compatVersion(' . TYPO3_branch . ')]'));
-        $this->assertTrue($this->matchCondition->match('[compatVersion("' . TYPO3_branch . '")]'));
-        $this->assertTrue($this->matchCondition->match('[compatVersion(\'' . TYPO3_branch . '\')]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionDoesNotMatchNewerRelease()
-    {
-        $this->assertFalse($this->matchCondition->match('[compatVersion(15.0)]'));
-        $this->assertFalse($this->matchCondition->match('[compatVersion("15.0")]'));
-        $this->assertFalse($this->matchCondition->match('[compatVersion(\'15.0\')]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'ENV'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceENV()
-    {
-        $testKey = $this->getUniqueId('test');
-        putenv($testKey . '=testValue');
-        $this->assertTrue($this->matchCondition->match('[getenv("' . $testKey . '") == "testValue"]'));
-    }
-}
diff --git a/typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
deleted file mode 100644 (file)
index 140aa78..0000000
+++ /dev/null
@@ -1,970 +0,0 @@
-<?php
-namespace TYPO3\CMS\Backend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching;
-
-/*
- * 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 Prophecy\Argument;
-use TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
-use TYPO3\CMS\Backend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching\Fixtures\TestConditionException;
-use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
-use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
-use TYPO3\CMS\Core\Context\Context;
-use TYPO3\CMS\Core\Context\UserAspect;
-use TYPO3\CMS\Core\Http\ServerRequest;
-use TYPO3\CMS\Core\Log\Logger;
-use TYPO3\CMS\Core\Package\PackageInterface;
-use TYPO3\CMS\Core\Package\PackageManager;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-/**
- * Testcase for class \TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher.
- */
-class ConditionMatcherTest extends UnitTestCase
-{
-    /**
-     * @var array
-     */
-    protected $rootline;
-
-    /**
-     * @var \TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher
-     */
-    protected $matchCondition;
-
-    /**
-     * @var string
-     */
-    protected $testGlobalNamespace;
-
-    /**
-     * @var string
-     */
-    protected $testTableName;
-
-    /**
-     * @var bool Reset singletons
-     */
-    protected $resetSingletonInstances = true;
-
-    /**
-     * Set up tests
-     */
-    protected function setUp()
-    {
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
-        $cacheFrontendProphecy->has(Argument::any())->willReturn(false);
-        $cacheFrontendProphecy->set(Argument::any(), Argument::any())->willReturn(null);
-        $cacheManagerProphecy = $this->prophesize(CacheManager::class);
-        $cacheManagerProphecy->getCache('cache_core')->willReturn($cacheFrontendProphecy->reveal());
-        GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
-
-        $packageManagerProphecy = $this->prophesize(PackageManager::class);
-        $corePackageProphecy = $this->prophesize(PackageInterface::class);
-        $corePackageProphecy->getPackagePath()->willReturn(__DIR__ . '/../../../../../../../sysext/core/');
-        $packageManagerProphecy->getActivePackages()->willReturn([
-            $corePackageProphecy->reveal()
-        ]);
-        GeneralUtility::setSingletonInstance(PackageManager::class, $packageManagerProphecy->reveal());
-        $this->testTableName = 'conditionMatcherTestTable';
-        $this->testGlobalNamespace = $this->getUniqueId('TEST');
-        $GLOBALS['TCA'][$this->testTableName] = ['ctrl' => []];
-        $GLOBALS[$this->testGlobalNamespace] = [];
-        $this->setUpBackend();
-        $this->matchCondition = $this->getAccessibleMock(ConditionMatcher::class, ['determineRootline'], [], '', false);
-        $this->matchCondition->method('determineRootline')->willReturn([
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ]);
-        $this->matchCondition->__construct();
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $this->matchCondition->setLogger($loggerProphecy->reveal());
-    }
-
-    /**
-     * Set up a backend
-     */
-    private function setUpBackend()
-    {
-        $this->rootline = [
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ];
-        $GLOBALS['BE_USER'] = $this->getMockBuilder(BackendUserAuthentication::class)
-            ->setMethods(['dummy'])
-            ->disableOriginalConstructor()
-            ->getMock();
-        $GLOBALS['BE_USER']->groupList = '13,14,15';
-        $GLOBALS['BE_USER']->user['uid'] = 13;
-        $GLOBALS['BE_USER']->user['admin'] = 1;
-
-        GeneralUtility::makeInstance(Context::class)
-            ->setAspect('backend.user', new UserAspect($GLOBALS['BE_USER']));
-    }
-
-    /**
-     * Set up database mock
-     */
-    private function setUpDatabaseMockForDeterminePageId()
-    {
-        $this->matchCondition = $this->getAccessibleMock(ConditionMatcher::class, ['determineRootline', 'determinePageId'], [], '', false);
-        $this->matchCondition->method('determineRootline')->willReturn([
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ]);
-        $this->matchCondition->__construct();
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $this->matchCondition->setLogger($loggerProphecy->reveal());
-
-        $this->matchCondition->expects($this->once())->method('determinePageId')->willReturn(999);
-    }
-
-    /**
-     * Tests whether a faulty expression fails.
-     *
-     * @test
-     */
-    public function simulateDisabledMatchAllConditionsFailsOnFaultyExpression()
-    {
-        $this->assertFalse($this->matchCondition->match('[nullCondition = This expression would return FALSE in general]'));
-    }
-
-    /**
-     * Tests whether simulating positive matches for all conditions succeeds.
-     *
-     * @test
-     */
-    public function simulateEnabledMatchAllConditionsSucceeds()
-    {
-        $this->matchCondition->setSimulateMatchResult(true);
-        $this->assertTrue($this->matchCondition->match('[nullCondition = This expression would return FALSE in general]'));
-    }
-
-    /**
-     * Tests whether simulating positive matches for specific conditions succeeds.
-     *
-     * @test
-     */
-    public function simulateEnabledMatchSpecificConditionsSucceeds()
-    {
-        $testCondition = '[' . $this->getUniqueId('test') . ' = Any condition to simulate a positive match]';
-        $this->matchCondition->setSimulateMatchConditions([$testCondition]);
-        $this->assertTrue($this->matchCondition->match($testCondition));
-    }
-
-    /**
-     * Tests whether the language comparison matches.
-     *
-     * @test
-     */
-    public function languageConditionMatchesSingleLanguageExpression()
-    {
-        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-        $this->assertTrue($this->matchCondition->match('[language = *de*]'));
-        $this->assertTrue($this->matchCondition->match('[language = *de-de*]'));
-    }
-
-    /**
-     * Tests whether the language comparison matches.
-     *
-     * @test
-     */
-    public function languageConditionMatchesMultipleLanguagesExpression()
-    {
-        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-        $this->assertTrue($this->matchCondition->match('[language = *en*,*de*]'));
-        $this->assertTrue($this->matchCondition->match('[language = *en-us*,*de-de*]'));
-    }
-
-    /**
-     * Tests whether the language comparison matches.
-     *
-     * @test
-     */
-    public function languageConditionMatchesCompleteLanguagesExpression()
-    {
-        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-        $this->assertTrue($this->matchCondition->match('[language = de-de,de;q=0.8,en-us;q=0.5,en;q=0.3]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesSingleGroupId()
-    {
-        $this->assertTrue($this->matchCondition->match('[usergroup = 13]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesMultipleUserGroupId()
-    {
-        $this->assertTrue($this->matchCondition->match('[usergroup = 999,15,14,13]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesAnyLoggedInUser()
-    {
-        $this->assertTrue($this->matchCondition->match('[loginUser = *]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesSingleLoggedInUser()
-    {
-        $this->assertTrue($this->matchCondition->match('[loginUser = 13]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionDoesNotMatchSingleLoggedInUser()
-    {
-        $GLOBALS['BE_USER']->user['uid'] = 13;
-        $this->assertFalse($this->matchCondition->match('[loginUser = 999]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesMultipleLoggedInUsers()
-    {
-        $this->assertTrue($this->matchCondition->match('[loginUser = 999,13]'));
-    }
-
-    /**
-     * Tests whether checkinf for an admin user matches
-     *
-     * @test
-     */
-    public function adminUserConditionMatchesAdminUser()
-    {
-        $this->assertTrue($this->matchCondition->match('[adminUser = 1]'));
-    }
-
-    /**
-     * Tests whether checkinf for an admin user matches
-     *
-     * @test
-     */
-    public function adminUserConditionMatchesRegularUser()
-    {
-        $GLOBALS['BE_USER']->user['uid'] = 14;
-        $GLOBALS['BE_USER']->user['admin'] = 0;
-        $this->assertTrue($this->matchCondition->match('[adminUser = 0]'));
-    }
-
-    /**
-     * Tests whether checkinf for an admin user matches
-     *
-     * @test
-     */
-    public function adminUserConditionDoesNotMatchRegularUser()
-    {
-        $GLOBALS['BE_USER']->user['uid'] = 14;
-        $GLOBALS['BE_USER']->user['admin'] = 0;
-        $this->assertFalse($this->matchCondition->match('[adminUser = 1]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnEqualExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 = 10]'), '1');
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 = 10.1]'), '2');
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 == 10]'), '3');
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 == 10.1]'), '4');
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:0 = 0]'), '5');
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:0 == 0]'), '6');
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnEqualExpressionWithMultipleValues()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 = 10|20|30]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 = 10.1|20.2|30.3]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20 = 10|20|30]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20.2 = 10.1|20.2|30.3]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 == 10|20|30]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 == 10.1|20.2|30.3]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20 == 10|20|30]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20.2 == 10.1|20.2|30.3]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnNotEqualExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 != 20]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 != 10.2]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:0 != 1]'));
-    }
-
-    /**
-     * Tests whether numerical comparison does not match.
-     *
-     * @test
-     */
-    public function globalVarConditionDoesNotMatchOnNotEqualExpression()
-    {
-        $this->assertFalse($this->matchCondition->match('[globalVar = LIT:10 != 10]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnNotEqualExpressionWithMultipleValues()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 != 20|30]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 != 10.2|20.3]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnLowerThanExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 < 20]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 < 10.2]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:0 < 1]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnLowerThanOrEqualExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 <= 10]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 <= 20]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 <= 10.1]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 <= 10.2]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnGreaterThanExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20 > 10]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.2 > 10.1]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:1 > 0]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnGreaterThanOrEqualExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10 >= 10]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:20 >= 10]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.1 >= 10.1]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = LIT:10.2 >= 10.1]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnEmptyExpressionWithNoValueSet()
-    {
-        $testKey = $this->getUniqueId('test');
-        $this->assertTrue($this->matchCondition->match('[globalVar = GP:' . $testKey . '=]'));
-        $this->assertTrue($this->matchCondition->match('[globalVar = GP:' . $testKey . ' = ]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionDoesNotMatchOnEmptyExpressionWithValueSetToZero()
-    {
-        $testKey = $this->getUniqueId('test');
-        $_GET = [];
-        $_POST = [$testKey => 0];
-        $this->assertFalse($this->matchCondition->match('[globalVar = GP:' . $testKey . '=]'));
-        $this->assertFalse($this->matchCondition->match('[globalVar = GP:' . $testKey . ' = ]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesOnEqualExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3.Test.Condition]'));
-        $this->assertFalse($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesOnEmptyExpressionWithValueSetToEmptyString()
-    {
-        $testKey = $this->getUniqueId('test');
-        $_GET = [];
-        $_POST = [$testKey => ''];
-        $this->assertTrue($this->matchCondition->match('[globalString = GP:' . $testKey . '=]'));
-        $this->assertTrue($this->matchCondition->match('[globalString = GP:' . $testKey . ' = ]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesOnEmptyLiteralExpressionWithValueSetToEmptyString()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT:=]'));
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT: = ]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesWildcardExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3?Test?Condition]'));
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3.T*t.Condition]'));
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3?T*t?Condition]'));
-        // globalString is not implemented, because globalVar did the job
-        // Access with LIT is not possible in expression language, because constants available as variable
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesRegularExpression()
-    {
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = /^[A-Za-z3.]+$/]'));
-        $this->assertTrue($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = /^TYPO3\\..+Condition$/]'));
-        $this->assertFalse($this->matchCondition->match('[globalString = LIT:TYPO3.Test.Condition = /^FALSE/]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesEmptyRegularExpression()
-    {
-        $testKey = $this->getUniqueId('test');
-        $_SERVER[$testKey] = '';
-        $this->assertTrue($this->matchCondition->match('[globalString = _SERVER|' . $testKey . ' = /^$/]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesSingleValue()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->assertTrue($this->matchCondition->match('[treeLevel = 2]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesMultipleValues()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->assertTrue($this->matchCondition->match('[treeLevel = 999,998,2]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionDoesNotMatchFaultyValue()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->assertFalse($this->matchCondition->match('[treeLevel = 999]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches when creating new pages.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesCurrentPageIdWhileEditingNewPage()
-    {
-        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
-        $GLOBALS['SOBE']->elementsData = [
-            [
-                'table' => 'pages',
-                'uid' => 'NEW4adc6021e37e7',
-                'pid' => 121,
-                'cmd' => 'new',
-                'deleteAccess' => 0
-            ]
-        ];
-        $GLOBALS['SOBE']->data = [];
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[treeLevel = 3]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches when creating new pages.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesCurrentPageIdWhileSavingNewPage()
-    {
-        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
-        $GLOBALS['SOBE']->elementsData = [
-            [
-                'table' => 'pages',
-                /// 999 is the uid of the page that was just created
-                'uid' => 999,
-                'pid' => 121,
-                'cmd' => 'edit',
-                'deleteAccess' => 1
-            ]
-        ];
-        $GLOBALS['SOBE']->data = [
-            'pages' => [
-                'NEW4adc6021e37e7' => [
-                    'pid' => 121
-                ]
-            ]
-        ];
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[treeLevel = 3]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesSinglePageIdInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[PIDupinRootline = 111]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesMultiplePageIdsInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[PIDupinRootline = 999,111,101]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionDoesNotMatchPageIdNotInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertFalse($this->matchCondition->match('[PIDupinRootline = 999]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionDoesNotMatchLastPageIdInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertFalse($this->matchCondition->match('[PIDupinRootline = 121]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesCurrentPageIdWhileEditingNewPage()
-    {
-        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
-        $GLOBALS['SOBE']->elementsData = [
-            [
-                'table' => 'pages',
-                'uid' => 'NEW4adc6021e37e7',
-                'pid' => 121,
-                'cmd' => 'new',
-                'deleteAccess' => 0
-            ]
-        ];
-        $GLOBALS['SOBE']->data = [];
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[PIDupinRootline = 121]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesCurrentPageIdWhileSavingNewPage()
-    {
-        $GLOBALS['SOBE'] = $this->createMock(\TYPO3\CMS\Backend\Controller\EditDocumentController::class);
-        $GLOBALS['SOBE']->elementsData = [
-            [
-                'table' => 'pages',
-                /// 999 is the uid of the page that was just created
-                'uid' => 999,
-                'pid' => 121,
-                'cmd' => 'edit',
-                'deleteAccess' => 1
-            ]
-        ];
-        $GLOBALS['SOBE']->data = [
-            'pages' => [
-                'NEW4adc6021e37e7' => [
-                    'pid' => 121
-                ]
-            ]
-        ];
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[PIDupinRootline = 121]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesSinglePageIdInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[PIDinRootline = 111]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesMultiplePageIdsInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[PIDinRootline = 999,111,101]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesLastPageIdInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertTrue($this->matchCondition->match('[PIDinRootline = 121]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionDoesNotMatchPageIdNotInRootline()
-    {
-        $this->matchCondition->setRootline($this->rootline);
-        $this->matchCondition->setPageId(121);
-        $this->assertFalse($this->matchCondition->match('[PIDinRootline = 999]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesOlderRelease()
-    {
-        $this->assertTrue($this->matchCondition->match('[compatVersion = 7.0]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesSameRelease()
-    {
-        $this->assertTrue($this->matchCondition->match('[compatVersion = ' . TYPO3_branch . ']'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionDoesNotMatchNewerRelease()
-    {
-        $this->assertFalse($this->matchCondition->match('[compatVersion = 15.0]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'GP'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceGP()
-    {
-        $_GET = ['testGet' => 'getTest'];
-        $_POST = ['testPost' => 'postTest'];
-        $this->assertTrue($this->matchCondition->match('[globalString = GP:testGet = getTest]'));
-        $this->assertTrue($this->matchCondition->match('[globalString = GP:testPost = postTest]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables does not work with the namespace 'TSFE',
-     * since we are in the backend context here.
-     *
-     * @test
-     */
-    public function genericGetVariablesFailsWithNamespaceTSFE()
-    {
-        $GLOBALS['TSFE'] = new \stdClass();
-        $GLOBALS['TSFE']->id = 1234567;
-        $this->assertFalse($this->matchCondition->match('[globalString = TSFE:id = 1234567]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'ENV'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceENV()
-    {
-        $testKey = $this->getUniqueId('test');
-        putenv($testKey . '=testValue');
-        $this->assertTrue($this->matchCondition->match('[globalString = ENV:' . $testKey . ' = testValue]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'IENV'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceIENV()
-    {
-        $_SERVER['HTTP_HOST'] = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY') . ':1234567';
-        // getIndpEnv() is polluted after above call, clear cache to have it recalculate for subject execption
-        GeneralUtility::flushInternalRuntimeCaches();
-        $this->assertTrue($this->matchCondition->match('[globalString = IENV:TYPO3_PORT = 1234567]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with any global namespace.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithAnyGlobalNamespace()
-    {
-        $GLOBALS[$this->testGlobalNamespace] = [
-            'first' => 'testFirst',
-            'second' => ['third' => 'testThird']
-        ];
-        $this->assertTrue($this->matchCondition->match('[globalString = ' . $this->testGlobalNamespace . '|first = testFirst]'));
-        $this->assertTrue($this->matchCondition->match('[globalString = ' . $this->testGlobalNamespace . '|second|third = testThird]'));
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileCallingModuleWithPageTree()
-    {
-        $_GET['id'] = 999;
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileEditingAPageRecord()
-    {
-        $_GET['edit']['pages'][999] = 'edit';
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileEditingARegularRecord()
-    {
-        $this->setUpDatabaseMockForDeterminePageId();
-        $_GET['edit'][$this->testTableName][13] = 'edit';
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileCreatingARecord()
-    {
-        $_GET['edit']['pages'][999] = 'new';
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileCreatingARecordAfterAnExistingRecord()
-    {
-        $this->setUpDatabaseMockForDeterminePageId();
-        $_GET['edit'][$this->testTableName][-13] = 'new';
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileDeletingAPageRecord()
-    {
-        $_GET['cmd']['pages'][999]['delete'] = 1;
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileCopyingARecordToAnotherPage()
-    {
-        $_GET['cmd']['pages'][121]['copy'] = 999;
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileCopyingARecordAfterAnExistingRecord()
-    {
-        $this->setUpDatabaseMockForDeterminePageId();
-        $_GET['cmd'][$this->testTableName][121]['copy'] = -13;
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * Tests whether determining a pageId works.
-     *
-     * @test
-     */
-    public function pageIdCanBeDeterminedWhileMovingARecordToAnotherPage()
-    {
-        $_GET['cmd']['pages'][121]['move'] = 999;
-        $this->matchCondition->match('[globalVar = LIT:10 = 10]');
-        $this->assertEquals(999, $this->matchCondition->getPageId());
-    }
-
-    /**
-     * @test
-     */
-    public function matchCallsTestConditionAndHandsOverParameters()
-    {
-        $this->expectException(TestConditionException::class);
-        $this->expectExceptionCode(1476109533);
-        $this->matchCondition->match('[TYPO3\\CMS\\Backend\\Tests\\UnitDeprecated\\Configuration\\TypoScript\\ConditionMatching\\Fixtures\\TestCondition = 7, != 6]');
-    }
-}
diff --git a/typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestCondition.php b/typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestCondition.php
deleted file mode 100644 (file)
index bfc8719..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-namespace TYPO3\CMS\Backend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching\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!
- */
-
-/**
- * Fixture for custom conditions
- */
-class TestCondition extends \TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractCondition
-{
-    /**
-     * Test matcher tests input parameters.
-     *
-     * @param array $conditionParameters
-     * @throws TestConditionException
-     * @return bool
-     */
-    public function matchCondition(array $conditionParameters)
-    {
-        // Throw an exception if everything is fine, this exception is *expected* in the according unit test
-        if ($conditionParameters[0] === '= 7' && $conditionParameters[1] === '!= 6') {
-            throw new TestConditionException('All Ok', 1476109533);
-        }
-    }
-}
diff --git a/typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestConditionException.php b/typo3/sysext/backend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestConditionException.php
deleted file mode 100644 (file)
index ee2f039..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-namespace TYPO3\CMS\Backend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching\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!
- */
-
-/**
- * Exception thrown by TestCondition
- */
-class TestConditionException extends \Exception
-{
-}
index f01ccbd..f21ed38 100644 (file)
@@ -17,14 +17,10 @@ namespace TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching;
 use Psr\Log\LoggerAwareInterface;
 use Psr\Log\LoggerAwareTrait;
 use Symfony\Component\ExpressionLanguage\SyntaxError;
-use TYPO3\CMS\Core\Configuration\Features;
 use TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException;
 use TYPO3\CMS\Core\Error\Exception;
 use TYPO3\CMS\Core\ExpressionLanguage\Resolver;
 use TYPO3\CMS\Core\Log\LogLevel;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Core\Utility\StringUtility;
-use TYPO3\CMS\Core\Utility\VersionNumberUtility;
 
 /**
  * Matching TypoScript conditions
@@ -72,14 +68,6 @@ abstract class AbstractConditionMatcher implements LoggerAwareInterface
     protected $expressionLanguageResolver;
 
     /**
-     * @return bool
-     */
-    protected function strictSyntaxEnabled(): bool
-    {
-        return GeneralUtility::makeInstance(Features::class)->isFeatureEnabled('TypoScript.strictSyntax');
-    }
-
-    /**
      * Sets the id of the page to evaluate conditions for.
      *
      * @param int $pageId Id of the page (must be positive)
@@ -146,66 +134,12 @@ abstract class AbstractConditionMatcher implements LoggerAwareInterface
     }
 
     /**
-     * Normalizes an expression
-     * + OR normalization: "...]OR[...", "...]||[...", "...][..." --> "...]||[..."
-     * + AND normalization: "...]AND[...", "...]&&[..."                   --> "...]&&[..."
-     *
-     * @param string $expression The expression to be normalized (e.g. "[A] && [B] OR [C]")
-     * @return string The normalized expression (e.g. "[A]&&[B]||[C]")
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function normalizeExpression($expression)
-    {
-        $removeSpaces = '/
-          \\s*
-          (                    # subroutine 1
-            \\[
-              (?:
-                [^\\[\\]]      # any character except []
-                | (?1)         # recursive subroutine 1 when brackets are around
-              )*
-            \\]
-          )
-          \\s*
-          /xi';
-
-        $adjacentBrackets = '/
-          (                    # subroutine 1
-            \\[
-              (?:
-                [^\\[\\]]      # any character except []
-                | (?1)         # recursive subroutine 1 when brackets are around
-              )*
-            \\]
-          )
-          (*SKIP)              # avoid backtracking into completed bracket expressions
-          \\[                  # match the following [
-          /xi';
-
-        return preg_replace(
-            [
-                $removeSpaces,
-                '/\\]AND\\[/i',
-                '/\\]OR\\[/i',
-                $adjacentBrackets
-            ],
-            [
-                '\\1',
-                ']&&[',
-                ']||[',
-                '\\1||['
-            ],
-            trim($expression)
-        );
-    }
-
-    /**
      * Matches a TypoScript condition expression.
      *
      * @param string $expression The expression to match
      * @return bool Whether the expression matched
      */
-    public function match($expression)
+    public function match($expression): bool
     {
         // Return directly if result should be simulated:
         if ($this->simulateMatchResult) {
@@ -213,54 +147,22 @@ abstract class AbstractConditionMatcher implements LoggerAwareInterface
         }
         // Return directly if matching for specific condition is simulated only:
         if (!empty($this->simulateMatchConditions)) {
-            return in_array($expression, $this->simulateMatchConditions);
-        }
-        // Sets the current pageId if not defined yet:
-        if (!isset($this->pageId)) {
-            $this->pageId = $this->determinePageId();
-        }
-        // Sets the rootline if not defined yet:
-        if (!isset($this->rootline)) {
-            $this->rootline = $this->determineRootline();
+            return in_array($expression, $this->simulateMatchConditions, true);
         }
         $result = false;
-        $normalizedExpression = $this->normalizeExpression($expression);
-        // First and last character must be square brackets (e.g. "[A]&&[B]":
-        if ($normalizedExpression[0] === '[' && substr($normalizedExpression, -1) === ']') {
-            $innerExpression = substr($normalizedExpression, 1, -1);
-            $orParts = explode(']||[', $innerExpression);
-            if ($this->strictSyntaxEnabled() && count($orParts) > 1) {
-                trigger_error('Multiple conditions blocks combined with AND, OR, && or || will be removed in TYPO3 v10.0, use the new expression language.', E_USER_DEPRECATED);
-            }
-            foreach ($orParts as $orPart) {
-                $andParts = explode(']&&[', $orPart);
-                if ($this->strictSyntaxEnabled() && count($andParts) > 1) {
-                    trigger_error('Multiple conditions blocks combined with AND, OR, && or || will be removed in TYPO3 v10.0, use the new expression language.', E_USER_DEPRECATED);
-                }
-                foreach ($andParts as $andPart) {
-                    $result = $this->evaluateExpression($andPart);
-                    if (!is_bool($result)) {
-                        $result = $this->evaluateCondition($andPart);
-                    }
-                    // If condition in AND context fails, the whole block is FALSE:
-                    if ($result === false) {
-                        break;
-                    }
-                }
-                // If condition in OR context succeeds, the whole expression is TRUE:
-                if ($result === true) {
-                    break;
-                }
-            }
+        // First and last character must be square brackets:
+        if (strpos($expression, '[') === 0 && substr($expression, -1) === ']') {
+            $innerExpression = substr($expression, 1, -1);
+            $result = $this->evaluateExpression($innerExpression);
         }
         return $result;
     }
 
     /**
      * @param string $expression
-     * @return bool|null
+     * @return bool
      */
-    protected function evaluateExpression(string $expression): ?bool
+    protected function evaluateExpression(string $expression): bool
     {
         try {
             $result = $this->expressionLanguageResolver->evaluate($expression);
@@ -268,16 +170,8 @@ abstract class AbstractConditionMatcher implements LoggerAwareInterface
                 return $result;
             }
         } catch (SyntaxError $exception) {
-            // SyntaxException means no support, let's try the fallback
-            $message = 'Expression could not be parsed, fallback kicks in.';
-            if (strpos($exception->getMessage(), 'Unexpected character "="') !== false) {
-                $message .= ' It looks like an old condition with only one equal sign.';
-            }
-            $this->logger->log(
-                $this->strictSyntaxEnabled() ? LogLevel::WARNING : LogLevel::INFO,
-                $message,
-                ['expression' => $expression]
-            );
+            $message = 'Expression could not be parsed.';
+            $this->logger->log(LogLevel::ERROR, $message, ['expression' => $expression]);
         } catch (\Throwable $exception) {
             // The following error handling is required to mitigate a missing type check
             // in the Symfony Expression Language handling. In case a condition
@@ -294,466 +188,11 @@ abstract class AbstractConditionMatcher implements LoggerAwareInterface
             ]);
             if (TYPO3_MODE === 'FE'
                 && $exception instanceof Exception
-                && $this->strictSyntaxEnabled()
                 && strpos($exception->getMessage(), 'in_array() expects parameter 2 to be array') !== false
             ) {
                 throw new InvalidTypoScriptConditionException('Invalid expression in condition: [' . $expression . ']', 1536950931);
             }
         }
-        return null;
-    }
-
-    /**
-     * Evaluates a TypoScript condition given as input, eg. "[applicationContext = Production][...(other condition)...]"
-     *
-     * @param string $key The condition to match against its criteria.
-     * @param string $value
-     * @return bool|null Result of the evaluation; NULL if condition could not be evaluated
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function evaluateConditionCommon($key, $value)
-    {
-        $keyParts = GeneralUtility::trimExplode('|', $key);
-        switch ($keyParts[0]) {
-            case 'applicationContext':
-                $values = GeneralUtility::trimExplode(',', $value, true);
-                $currentApplicationContext = GeneralUtility::getApplicationContext();
-                foreach ($values as $applicationContext) {
-                    if ($this->searchStringWildcard($currentApplicationContext, $applicationContext)) {
-                        return true;
-                    }
-                }
-                return false;
-            case 'language':
-                if (GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE') === $value) {
-                    return true;
-                }
-                $values = GeneralUtility::trimExplode(',', $value, true);
-                foreach ($values as $test) {
-                    // matches a string with asterix in front and back. See https://docs.typo3.org/typo3cms/TyposcriptReference/Conditions/Reference.html#language for use case.
-                    if (preg_match('/^\\*.+\\*$/', $test)) {
-                        $allLanguages = preg_split('/[,;]/', GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE'));
-                        if (in_array(substr($test, 1, -1), $allLanguages)) {
-                            return true;
-                        }
-                    } elseif (GeneralUtility::getIndpEnv('HTTP_ACCEPT_LANGUAGE') == $test) {
-                        return true;
-                    }
-                }
-                return false;
-            case 'IP':
-                if ($value === 'devIP') {
-                    $value = trim($GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask']);
-                }
-
-                return (bool)GeneralUtility::cmpIP(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value);
-            case 'hostname':
-                return (bool)GeneralUtility::cmpFQDN(GeneralUtility::getIndpEnv('REMOTE_ADDR'), $value);
-            case 'hour':
-            case 'minute':
-            case 'month':
-            case 'year':
-            case 'dayofweek':
-            case 'dayofmonth':
-            case 'dayofyear':
-                // In order to simulate time properly in templates.
-                $theEvalTime = $GLOBALS['SIM_EXEC_TIME'];
-                switch ($key) {
-                    case 'hour':
-                        $theTestValue = date('H', $theEvalTime);
-                        break;
-                    case 'minute':
-                        $theTestValue = date('i', $theEvalTime);
-                        break;
-                    case 'month':
-                        $theTestValue = date('m', $theEvalTime);
-                        break;
-                    case 'year':
-                        $theTestValue = date('Y', $theEvalTime);
-                        break;
-                    case 'dayofweek':
-                        $theTestValue = date('w', $theEvalTime);
-                        break;
-                    case 'dayofmonth':
-                        $theTestValue = date('d', $theEvalTime);
-                        break;
-                    case 'dayofyear':
-                        $theTestValue = date('z', $theEvalTime);
-                        break;
-                    default:
-                        $theTestValue = 0;
-                        break;
-                }
-                $theTestValue = (int)$theTestValue;
-                // comp
-                $values = GeneralUtility::trimExplode(',', $value, true);
-                foreach ($values as $test) {
-                    if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($test)) {
-                        $test = '=' . $test;
-                    }
-                    if ($this->compareNumber($test, $theTestValue)) {
-                        return true;
-                    }
-                }
-                return false;
-            case 'compatVersion':
-                return VersionNumberUtility::convertVersionNumberToInteger(TYPO3_branch) >= VersionNumberUtility::convertVersionNumberToInteger($value);
-            case 'loginUser':
-                if ($this->isUserLoggedIn()) {
-                    $values = GeneralUtility::trimExplode(',', $value, true);
-                    foreach ($values as $test) {
-                        if ($test === '*' || (string)$this->getUserId() === (string)$test) {
-                            return true;
-                        }
-                    }
-                } elseif ($value === '') {
-                    return true;
-                }
-                return false;
-            case 'page':
-                if ($keyParts[1]) {
-                    $page = $this->getPage();
-                    $property = $keyParts[1];
-                    if (!empty($page) && isset($page[$property]) && (string)$page[$property] === (string)$value) {
-                        return true;
-                    }
-                }
-                return false;
-            case 'globalVar':
-                $values = GeneralUtility::trimExplode(',', $value, true);
-                foreach ($values as $test) {
-                    $point = strcspn($test, '!=<>');
-                    $theVarName = substr($test, 0, $point);
-                    $nv = $this->getVariable(trim($theVarName));
-                    $testValue = substr($test, $point);
-                    if ($this->compareNumber($testValue, $nv)) {
-                        return true;
-                    }
-                }
-                return false;
-            case 'globalString':
-                $values = GeneralUtility::trimExplode(',', $value, true);
-                foreach ($values as $test) {
-                    $point = strcspn($test, '=');
-                    $theVarName = substr($test, 0, $point);
-                    $nv = (string)$this->getVariable(trim($theVarName));
-                    $testValue = substr($test, $point + 1);
-                    if ($this->searchStringWildcard($nv, trim($testValue))) {
-                        return true;
-                    }
-                }
-                return false;
-            case 'userFunc':
-                $matches = [];
-                preg_match_all('/^\s*([^\(\s]+)\s*(?:\((.*)\))?\s*$/', $value, $matches);
-                $funcName = $matches[1][0];
-                $funcValues = trim($matches[2][0]) !== '' ? $this->parseUserFuncArguments($matches[2][0]) : [];
-                if (is_callable($funcName) && call_user_func_array($funcName, $funcValues)) {
-                    return true;
-                }
-                return false;
-        }
-        return null;
-    }
-
-    /**
-     * Evaluates a TypoScript condition given as input with a custom class name,
-     * e.g. "[MyCompany\MyPackage\ConditionMatcher\MyOwnConditionMatcher = myvalue]"
-     *
-     * @param string $condition The condition to match
-     * @return bool|null Result of the evaluation; NULL if condition could not be evaluated
-     * @throws \TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function evaluateCustomDefinedCondition($condition)
-    {
-        $conditionResult = null;
-
-        list($conditionClassName, $conditionParameters) = GeneralUtility::trimExplode(' ', $condition, false, 2);
-
-        // Check if the condition class name is a valid class
-        // This is necessary to not stop here for the conditions ELSE and GLOBAL
-        if (class_exists($conditionClassName)) {
-            // Use like this: [MyCompany\MyPackage\ConditionMatcher\MyOwnConditionMatcher = myvalue]
-            /** @var \TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractCondition $conditionObject */
-            $conditionObject = GeneralUtility::makeInstance($conditionClassName);
-            if (($conditionObject instanceof \TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractCondition) === false) {
-                throw new \TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException(
-                    '"' . $conditionClassName . '" is not a valid TypoScript Condition object.',
-                    1410286153
-                );
-            }
-
-            $conditionParameters = $this->parseUserFuncArguments($conditionParameters);
-            $conditionObject->setConditionMatcherInstance($this);
-            $conditionResult = $conditionObject->matchCondition($conditionParameters);
-        }
-
-        return $conditionResult;
-    }
-
-    /**
-     * Parses arguments to the userFunc.
-     *
-     * @param string $arguments
-     * @return array
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function parseUserFuncArguments($arguments)
-    {
-        $result = [];
-        $arguments = trim($arguments);
-        while ($arguments !== '') {
-            if ($arguments[0] === ',') {
-                $result[] = '';
-                $arguments = substr($arguments, 1);
-            } else {
-                $pos = strcspn($arguments, ',\'"');
-                if ($pos == 0) {
-                    // We hit a quote of some kind
-                    $quote = $arguments[0];
-                    $segment = preg_replace('/^(.*?[^\\\])' . $quote . '.*$/', '\1', substr($arguments, 1));
-                    $segment = str_replace('\\' . $quote, $quote, $segment);
-                    $result[] = $segment;
-                    // shorten $arguments
-                    $arguments = substr($arguments, strlen($segment) + 2);
-                    $offset = strpos($arguments, ',');
-                    if ($offset === false) {
-                        $offset = strlen($arguments);
-                    }
-                    $arguments = substr($arguments, $offset + 1);
-                } else {
-                    $result[] = trim(substr($arguments, 0, $pos));
-                    $arguments = substr($arguments, $pos + 1);
-                }
-            }
-            $arguments = trim($arguments);
-        }
-        return $result;
-    }
-
-    /**
-     * Get variable common
-     *
-     * @param array $vars
-     * @return mixed Whatever value. If none, then NULL.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getVariableCommon(array $vars)
-    {
-        $value = null;
-        $namespace = trim($vars[0]);
-        if (count($vars) === 1) {
-            $value = $this->getGlobal($vars[0]);
-        } elseif ($namespace === 'LIT') {
-            $value = trim($vars[1]);
-        } else {
-            $splitAgain = explode('|', $vars[1], 2);
-            $k = trim($splitAgain[0]);
-            if ($k) {
-                switch ($namespace) {
-                    case 'GP':
-                        $value = GeneralUtility::_GP($k);
-                        break;
-                    case 'GPmerged':
-                        $value = GeneralUtility::_GPmerged($k);
-                        break;
-                    case 'ENV':
-                        $value = getenv($k);
-                        break;
-                    case 'IENV':
-                        $value = GeneralUtility::getIndpEnv($k);
-                        break;
-                    default:
-                        return null;
-                }
-                // If array:
-                if (count($splitAgain) > 1) {
-                    if (is_array($value) && trim($splitAgain[1]) !== '') {
-                        $value = $this->getGlobal($splitAgain[1], $value);
-                    } else {
-                        $value = '';
-                    }
-                }
-            }
-        }
-        return $value;
-    }
-
-    /**
-     * Evaluates a $leftValue based on an operator: "<", ">", "<=", ">=", "!=" or "="
-     *
-     * @param string $test The value to compare with on the form [operator][number]. Eg. "< 123
-     * @param float $leftValue The value on the left side
-     * @return bool If $value is "50" and $test is "< 123" then it will return TRUE.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function compareNumber($test, $leftValue)
-    {
-        if (preg_match('/^(!?=+|<=?|>=?)\\s*([^\\s]*)\\s*$/', $test, $matches)) {
-            $operator = $matches[1];
-            $rightValue = $matches[2];
-            switch ($operator) {
-                case '>=':
-                    return $leftValue >= (float)$rightValue;
-                    break;
-                case '<=':
-                    return $leftValue <= (float)$rightValue;
-                    break;
-                case '!=':
-                    // multiple values may be split with '|'
-                    // see if none matches ("not in list")
-                    $found = false;
-                    $rightValueParts = GeneralUtility::trimExplode('|', $rightValue);
-                    foreach ($rightValueParts as $rightValueSingle) {
-                        if ($leftValue == (float)$rightValueSingle) {
-                            $found = true;
-                            break;
-                        }
-                    }
-                    return $found === false;
-                    break;
-                case '<':
-                    return $leftValue < (float)$rightValue;
-                    break;
-                case '>':
-                    return $leftValue > (float)$rightValue;
-                    break;
-                default:
-                    // nothing valid found except '=', use '='
-                    // multiple values may be split with '|'
-                    // see if one matches ("in list")
-                    $found = false;
-                    $rightValueParts = GeneralUtility::trimExplode('|', $rightValue);
-                    foreach ($rightValueParts as $rightValueSingle) {
-                        if ($leftValue == $rightValueSingle) {
-                            $found = true;
-                            break;
-                        }
-                    }
-                    return $found;
-            }
-        }
         return false;
     }
-
-    /**
-     * Matching two strings against each other, supporting a "*" wildcard or (if wrapped in "/") PCRE regular expressions
-     *
-     * @param string $haystack The string in which to find $needle.
-     * @param string $needle The string to find in $haystack
-     * @return bool Returns TRUE if $needle matches or is found in (according to wildcards) in $haystack. Eg. if $haystack is "Netscape 6.5" and $needle is "Net*" or "Net*ape" then it returns TRUE.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function searchStringWildcard($haystack, $needle)
-    {
-        return StringUtility::searchStringWildcard($haystack, $needle);
-    }
-
-    /**
-     * Return global variable where the input string $var defines array keys separated by "|"
-     * Example: $var = "HTTP_SERVER_VARS | something" will return the value $GLOBALS['HTTP_SERVER_VARS']['something'] value
-     *
-     * @param string $var Global var key, eg. "HTTP_GET_VAR" or "HTTP_GET_VARS|id" to get the GET parameter "id" back.
-     * @param array $source Alternative array than $GLOBAL to get variables from.
-     * @return mixed Whatever value. If none, then blank string.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getGlobal($var, $source = null)
-    {
-        $vars = explode('|', $var);
-        $c = count($vars);
-        $k = trim($vars[0]);
-        $theVar = isset($source) ? ($source[$k] ?? null) : ($GLOBALS[$k] ?? null);
-        for ($a = 1; $a < $c; $a++) {
-            if (!isset($theVar)) {
-                break;
-            }
-            $key = trim($vars[$a]);
-            if (is_object($theVar)) {
-                $theVar = $theVar->{$key};
-            } elseif (is_array($theVar)) {
-                $theVar = $theVar[$key];
-            } else {
-                return '';
-            }
-        }
-        if (!is_array($theVar) && !is_object($theVar)) {
-            return $theVar;
-        }
-        return '';
-    }
-
-    /**
-     * Evaluates a TypoScript condition given as input, eg. "[browser=net][...(other conditions)...]"
-     *
-     * @param string $string The condition to match against its criteria.
-     * @return bool Whether the condition matched
-     * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::parse()
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function evaluateCondition($string);
-
-    /**
-     * Gets the value of a variable.
-     *
-     * Examples of names:
-     * + TSFE:id
-     * + GP:firstLevel|secondLevel
-     * + _GET|firstLevel|secondLevel
-     * + LIT:someLiteralValue
-     *
-     * @param string $name The name of the variable to fetch the value from
-     * @return mixed The value of the given variable (string) or NULL if variable did not exist
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function getVariable($name);
-
-    /**
-     * Gets the usergroup list of the current user.
-     *
-     * @return string The usergroup list of the current user
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function getGroupList();
-
-    /**
-     * Determines the current page Id.
-     *
-     * @return int The current page Id
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function determinePageId();
-
-    /**
-     * Gets the properties for the current page.
-     *
-     * @return array The properties for the current page.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function getPage();
-
-    /**
-     * Determines the rootline for the current page.
-     *
-     * @return array The rootline for the current page.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function determineRootline();
-
-    /**
-     * Gets the id of the current user.
-     *
-     * @return int The id of the current user
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function getUserId();
-
-    /**
-     * Determines if a user is logged in.
-     *
-     * @return bool Determines if a user is logged in
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    abstract protected function isUserLoggedIn();
 }
index 13b1d14..3c1c945 100644 (file)
@@ -74,7 +74,6 @@ return [
         'features' => [
             'redirects.hitCount' => false,
             'unifiedPageTranslationHandling' => false,
-            'TypoScript.strictSyntax' => true,
         ],
         'createGroup' => '',
         'sitename' => 'TYPO3',
index 12fbcf6..ab95b9a 100644 (file)
@@ -218,9 +218,6 @@ SYS:
               redirects.hitCount:
                 type: bool
                 description: 'If on, and if extension "redirects" is loaded, each performed redirect is counted and last hit time is logged to the database.'
-              TypoScript.strictSyntax:
-                type: bool
-                description: 'If on, TypoScript is parsed in strict syntax modes. Enabling this feature means old condition syntax (which is deprecated) will trigger deprecation messages.'
         availablePasswordHashAlgorithms:
             type: array
             description: 'A list of available password hash mechanisms. Extensions may register additional mechanisms here. This is usually not extended in LocalConfiguration.php.'
index cd06413..b1f1589 100644 (file)
@@ -198,6 +198,16 @@ The following PHP class methods that have been previously deprecated for v9 have
 * :php:`TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider->foreignTranslationTable()`
 * :php:`TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider->getTranslationTable()`
 * :php:`TYPO3\CMS\Backend\Configuration\TranslationConfigurationProvider->isTranslationInOwnTable()`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->evaluateCondition($string)`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getVariable($var)`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getGroupList()`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getPage()`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->isNewPageWithPageId($pageId)`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->determineRootline()`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getUserId()`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->isUserLoggedIn()`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->isAdminUser()`
+* :php:`TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getBackendUserAuthentication()`
 * :php:`TYPO3\CMS\Backend\Controller\ContentElement\MoveElementController->main()`
 * :php:`TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController->main()`
 * :php:`TYPO3\CMS\Backend\Controller\ContentElement\NewContentElementController->removeInvalidElements()`
@@ -278,6 +288,23 @@ The following PHP class methods that have been previously deprecated for v9 have
 * :php:`TYPO3\CMS\Core\Charset\CharsetConverter->parse_charset()`
 * :php:`TYPO3\CMS\Core\Charset\CharsetConverter->utf8_char2byte_pos()`
 * :php:`TYPO3\CMS\Core\Charset\CharsetConverter->utf8_to_entities()`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->strictSyntaxEnabled()`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->normalizeExpression($expression)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->evaluateConditionCommon($key, $value)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->evaluateCustomDefinedCondition($condition)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->parseUserFuncArguments($arguments)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->getVariableCommon(array $vars)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->compareNumber($test, $leftValue)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->searchStringWildcard($haystack, $needle)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->getGlobal($var, $source = null)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->evaluateCondition($string)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->getVariable($name)`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->getGroupList()`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->determinePageId()`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->getPage()`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->determineRootline()`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->getUserId()`
+* :php:`TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher->isUserLoggedIn()`
 * :php:`TYPO3\CMS\Core\Core\Bootstrap->__construct()`
 * :php:`TYPO3\CMS\Core\Core\Bootstrap->configure()`
 * :php:`TYPO3\CMS\Core\Core\Bootstrap->createApplicationContext()`
@@ -383,6 +410,18 @@ The following PHP class methods that have been previously deprecated for v9 have
 * :php:`TYPO3\CMS\Extensionmanager\Utility\InstallUtility->updateDbWithExtTablesSql()`
 * :php:`TYPO3\CMS\Fluid\Core\Widget\Bootstrap->configureObjectManager()`
 * :php:`TYPO3\CMS\Filelist\FileFacade->getIcon()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->evaluateCondition($string)`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getVariable($var)`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getSessionVariable(string $var)`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getGroupList()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->determinePageId()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getPage()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->determineRootline()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getUserId()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->isUserLoggedIn()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getTypoScriptFrontendController()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getCurrentSiteLanguage()`
+* :php:`TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher->getCurrentSite()`
 * :php:`TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->addParams()`
 * :php:`TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->calcIntExplode()`
 * :php:`TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer->currentPageUrl()`
@@ -1221,6 +1260,29 @@ The following TypoScript options have been dropped:
 * `IMGMENU`
 * `IMGMENUITEMS`
 
+The following TypoScript conditions have been dropped:
+
+* `language`
+* `IP`
+* `hostname`
+* `applicationContext`
+* `hour`
+* `minute`
+* `month`
+* `year`
+* `dayofweek`
+* `dayofmonth`
+* `dayofyear`
+* `usergroup`
+* `loginUser`
+* `page`
+* `treeLevel`
+* `PIDinRootline`
+* `PIDupinRootline`
+* `compatVersion`
+* `globalVar`
+* `globalString`
+* `userFunc`
 
 The following constants have been dropped:
 
@@ -1337,6 +1399,7 @@ The following features are now always enabled:
 * Extbase's :php:`consistentTranslationOverlayHandling` - Translations in Extbase are now always consistent
 * :php:`simplifiedControllerActionDispatching` - Backend controller actions do not receive a prepared response object anymore
 * :php:`unifiedPageTranslationHandling` - Page Translations are not within `pages_language_overlay` anymore
+* TypoScript condition strict syntax - The feature toggle :php:`TypoScript.strictSyntax` has been dropped
 
 
 The following features have been removed:
index eef92b4..fa02ab8 100644 (file)
@@ -260,12 +260,12 @@ page {
        stdWrap.postUserFunc = TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Renderer->renderSections
 }
 
-[globalVar = GP:L = 1]
+[request.getQueryParams()['L'] == 1 || request.getParsedBody()['L'] == 1]
 config.sys_language_uid = 1
 [end]
-[globalVar = GP:L = 2]
+[request.getQueryParams()['L'] == 2 || request.getParsedBody()['L'] == 2]
 config.sys_language_uid = 2
 [end]
-[globalVar = GP:L = 3]
+[request.getQueryParams()['L'] == 3 || request.getParsedBody()['L'] == 3]
 config.sys_language_uid = 3
 [end]
index d5ff42f..981c5ee 100644 (file)
@@ -16,6 +16,7 @@ namespace TYPO3\CMS\Core\Tests\Unit\Configuration\TypoScript\ConditionMatching;
  */
 
 use Prophecy\Argument;
+use Psr\Log\NullLogger;
 use TYPO3\CMS\Backend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
 use TYPO3\CMS\Core\Cache\CacheManager;
 use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
@@ -24,7 +25,6 @@ use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Context\DateTimeAspect;
 use TYPO3\CMS\Core\Core\ApplicationContext;
 use TYPO3\CMS\Core\Http\ServerRequest;
-use TYPO3\CMS\Core\Log\Logger;
 use TYPO3\CMS\Core\Package\PackageInterface;
 use TYPO3\CMS\Core\Package\PackageManager;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -48,11 +48,6 @@ class AbstractConditionMatcherTest extends UnitTestCase
     /**
      * @var \ReflectionMethod
      */
-    protected $evaluateConditionCommonMethod;
-
-    /**
-     * @var \ReflectionMethod
-     */
     protected $evaluateExpressionMethod;
 
     /**
@@ -67,8 +62,10 @@ class AbstractConditionMatcherTest extends UnitTestCase
         $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
         $cacheFrontendProphecy->has(Argument::any())->willReturn(false);
         $cacheFrontendProphecy->set(Argument::any(), Argument::any())->willReturn(null);
+        $cacheFrontendProphecy->get('backendUtilityBeGetRootLine')->willReturn([]);
         $cacheManagerProphecy = $this->prophesize(CacheManager::class);
         $cacheManagerProphecy->getCache('cache_core')->willReturn($cacheFrontendProphecy->reveal());
+        $cacheManagerProphecy->getCache('cache_runtime')->willReturn($cacheFrontendProphecy->reveal());
         GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
 
         $packageManagerProphecy = $this->prophesize(PackageManager::class);
@@ -86,13 +83,10 @@ class AbstractConditionMatcherTest extends UnitTestCase
     protected function initConditionMatcher()
     {
         // test the abstract methods via the backend condition matcher
-        $this->conditionMatcher = $this->getAccessibleMock(ConditionMatcher::class, ['determineRootline']);
-        $this->evaluateConditionCommonMethod = new \ReflectionMethod(AbstractConditionMatcher::class, 'evaluateConditionCommon');
-        $this->evaluateConditionCommonMethod->setAccessible(true);
         $this->evaluateExpressionMethod = new \ReflectionMethod(AbstractConditionMatcher::class, 'evaluateExpression');
         $this->evaluateExpressionMethod->setAccessible(true);
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $this->conditionMatcher->setLogger($loggerProphecy->reveal());
+        $this->conditionMatcher = new ConditionMatcher();
+        $this->conditionMatcher->setLogger(new NullLogger());
     }
 
     /**
@@ -107,38 +101,6 @@ class AbstractConditionMatcherTest extends UnitTestCase
     /**
      * @return array
      */
-    public function datesConditionDataProvider(): array
-    {
-        return [
-            '[dayofmonth = 17]' => ['dayofmonth', 17, true],
-            '[dayofweek = 3]' => ['dayofweek', 3, true],
-            '[dayofyear = 16]' => ['dayofyear', 16, true],
-            '[hour = 11]' => ['hour', 11, true],
-            '[minute = 4]' => ['minute', 4, true],
-            '[month = 1]' => ['month', 1, true],
-            '[year = 1945]' => ['year', 1945, true],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider datesConditionDataProvider
-     * @param string $expressionMethod
-     * @param int $expressionValue
-     * @param bool $expected
-     */
-    public function checkConditionMatcherForDates(string $expressionMethod, int $expressionValue, bool $expected): void
-    {
-        $GLOBALS['SIM_EXEC_TIME'] = mktime(11, 4, 0, 1, 17, 1945);
-        $this->assertSame($expected, $this->evaluateConditionCommonMethod->invokeArgs(
-            $this->conditionMatcher,
-            [$expressionMethod, $expressionValue]
-        ));
-    }
-
-    /**
-     * @return array
-     */
     public function datesFunctionDataProvider(): array
     {
         return [
@@ -212,34 +174,6 @@ class AbstractConditionMatcherTest extends UnitTestCase
     }
 
     /**
-     * @return array
-     */
-    public function hostnameDataProvider(): array
-    {
-        return [
-            '[hostname = localhost]' => ['hostname', 'localhost', true],
-            '[hostname = localhost, foo.local]' => ['hostname', 'localhost, foo.local', true],
-            '[hostname = bar.local, foo.local]' => ['hostname', 'bar.local, foo.local', false],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider hostnameDataProvider
-     * @param string $expressionMethod
-     * @param string $expressionValue
-     * @param bool $expected
-     */
-    public function checkConditionMatcherForHostname(string $expressionMethod, string $expressionValue, bool $expected): void
-    {
-        $GLOBALS['_SERVER']['REMOTE_ADDR'] = '127.0.0.1';
-        $this->assertSame($expected, $this->evaluateConditionCommonMethod->invokeArgs(
-            $this->conditionMatcher,
-            [$expressionMethod, $expressionValue]
-        ));
-    }
-
-    /**
      * Data provider with matching applicationContext conditions.
      *
      * @return array
@@ -265,9 +199,6 @@ class AbstractConditionMatcherTest extends UnitTestCase
         $applicationContext = new ApplicationContext('Production/Staging/Server2');
         Fixtures\GeneralUtilityFixture::setApplicationContext($applicationContext);
 
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs($this->conditionMatcher, ['applicationContext', $matchingContextCondition])
-        );
         // Test expression language
         $this->assertTrue(
             $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like("' . $applicationContext . '", "' . preg_quote($matchingContextCondition, '/') . '")'])
@@ -301,9 +232,6 @@ class AbstractConditionMatcherTest extends UnitTestCase
         $applicationContext = new ApplicationContext('Production/Staging/Server2');
         Fixtures\GeneralUtilityFixture::setApplicationContext($applicationContext);
 
-        $this->assertFalse(
-            $this->evaluateConditionCommonMethod->invokeArgs($this->conditionMatcher, ['applicationContext', $notMatchingApplicationContextCondition])
-        );
         // Test expression language
         $this->assertFalse(
             $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like("' . $applicationContext . '", "' . preg_quote($notMatchingApplicationContextCondition, '/') . '")'])
@@ -380,370 +308,6 @@ class AbstractConditionMatcherTest extends UnitTestCase
         $this->assertSame($expectedResult, $result);
     }
 
-    /**
-     * @test
-     */
-    public function testUserFuncIsCalled(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunction']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithSingleArgument(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithSingleArgument(x)']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithIntegerZeroArgument(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithSingleArgument(0)']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithWhitespaceArgument(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithNoArgument( )']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleArguments(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments(1,2,3)']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsNullBoolString(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments(0,true,"foo")']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsNullStringBool(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments(0,"foo",true)']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsStringBoolNull(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments("foo",true,0)']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsStringNullBool(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments("foo",0,true)']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsBoolNullString(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments(true,0,"foo")']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsBoolStringNull(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments(true,"foo",0)']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsNullBoolStringSingleQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', "user_testFunctionWithThreeArguments(0,true,'foo')"]
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsNullStringBoolSingleQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', "user_testFunctionWithThreeArguments(0,'foo',true)"]
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsStringBoolNullSingleQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', "user_testFunctionWithThreeArguments('foo',true,0)"]
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsStringNullBoolSingleQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', "user_testFunctionWithThreeArguments('foo',0,true)"]
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsBoolNullStringSingleQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', "user_testFunctionWithThreeArguments(true,0,'foo')"]
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleDifferentArgumentsBoolStringNullSingleQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', "user_testFunctionWithThreeArguments(true,'foo',0)"]
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleSingleQuotedArguments(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', "user_testFunctionWithThreeArguments('foo','bar', 'baz')"]
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleSoubleQuotedArguments(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments("foo","bar","baz")']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncReturnsFalse(): void
-    {
-        $this->assertFalse(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionFalse']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleArgumentsAndQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments(1,2,"3,4,5,6")']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleArgumentsAndQuotesAndSpaces(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArguments ( 1 , 2, "3, 4, 5, 6" )']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleArgumentsAndQuotesAndSpacesStripped(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArgumentsSpaces ( 1 , 2, "3, 4, 5, 6" )']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithSpacesInQuotes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithSpaces(" 3, 4, 5, 6 ")']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithMultipleArgumentsAndQuotesAndSpacesStrippedAndEscapes(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithThreeArgumentsSpaces ( 1 , 2, "3, \"4, 5\", 6" )']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithQuoteMissing(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testFunctionWithQuoteMissing ("value \")']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithQuotesInside(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'user_testQuotes("1 \" 2")']
-            )
-        );
-    }
-
-    /**
-     * @test
-     */
-    public function testUserFuncWithClassMethodCall(): void
-    {
-        $this->assertTrue(
-            $this->evaluateConditionCommonMethod->invokeArgs(
-                $this->conditionMatcher,
-                ['userFunc', 'ConditionMatcherUserFunctions::isTrue(1)']
-            )
-        );
-    }
-
     public function expressionDataProvider(): array
     {
         return [
@@ -786,15 +350,4 @@ class AbstractConditionMatcherTest extends UnitTestCase
             '[request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]' => ['[request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]', '[request.getQueryParams()[\'tx_news_pi1\'][\'news\'] > 0]'],
         ];
     }
-
-    /**
-     * @test
-     * @dataProvider expressionDataProvider
-     * @param string $expression
-     * @param string $expectedResult
-     */
-    public function normalizeExpressionWorksAsExpected(string $expression, string $expectedResult): void
-    {
-        $this->assertSame($expectedResult, $this->conditionMatcher->_call('normalizeExpression', $expression));
-    }
 }
index af1ae53..b383fbe 100644 (file)
@@ -431,12 +431,12 @@ class TypoScriptParserTest extends UnitTestCase
             'TS code before not matching include' => [
                 '
                 foo = bar
-                <INCLUDE_TYPOSCRIPT: source="FILE:dev.ts" condition="applicationContext = /^NotMatched/">
+                <INCLUDE_TYPOSCRIPT: source="FILE:dev.ts" condition="applicationContext matches \"/^NotMatched/\"">
                 '
             ],
             'TS code after not matching include' => [
                 '
-                <INCLUDE_TYPOSCRIPT: source="FILE:dev.ts" condition="applicationContext = /^NotMatched/">
+                <INCLUDE_TYPOSCRIPT: source="FILE:dev.ts" condition="applicationContext matches \"/^NotMatched/\"">
                 foo = bar
                 '
             ],
@@ -458,7 +458,9 @@ class TypoScriptParserTest extends UnitTestCase
         $cacheProphecy->set(Argument::cetera())->willReturn(false);
         GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
 
-        GeneralUtility::addInstance(ConditionMatcher::class, $this->prophesize(ConditionMatcher::class)->reveal());
+        $p = $this->prophesize(ConditionMatcher::class);
+        $p->match(Argument::cetera())->willReturn(false);
+        GeneralUtility::addInstance(ConditionMatcher::class, $p->reveal());
 
         $resolvedIncludeLines = TypoScriptParser::checkIncludeLines($typoScript);
         $this->assertContains('foo = bar', $resolvedIncludeLines);
index b9cf140..74e476f 100644 (file)
@@ -34,12 +34,12 @@ page {
        stdWrap.postUserFunc = TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Renderer->renderSections
 }
 
-[globalVar = GP:L = 1]
+[request.getQueryParams()['L'] == 1 || request.getParsedBody()['L'] == 1]
        config.sys_language_uid = 1
 [end]
-[globalVar = GP:L = 2]
+[request.getQueryParams()['L'] == 2 || request.getParsedBody()['L'] == 2]
        config.sys_language_uid = 2
 [end]
-[globalVar = GP:L = 3]
+[request.getQueryParams()['L'] == 3 || request.getParsedBody()['L'] == 3]
        config.sys_language_uid = 3
 [end]
index 332cf13..5ebdee0 100644 (file)
@@ -36,6 +36,6 @@ page {
        stdWrap.postUserFunc = TYPO3\TestingFramework\Core\Functional\Framework\Frontend\Renderer->renderSections
 }
 
-[globalVar = GP:L = 1]
+[request.getQueryParams()['L'] == 1 || request.getParsedBody()['L'] == 1]
        config.sys_language_uid = 1
 [end]
index 310773b..d2d2591 100644 (file)
@@ -39,7 +39,7 @@ lib.viewConfig {
     }
 }
 
-[globalVar = GP:override = overrideAll]
+[request.getQueryParams()['override'] == 'overrideAll' || request.getParsedBody()['override'] == 'overrideAll']
     lib.viewConfig {
         templateRootPaths {
             10 = EXT:fluid_test/Resources/Private/Override/Templates/
@@ -55,7 +55,7 @@ lib.viewConfig {
     }
 [end]
 
-[globalVar = GP:override = templateOverride]
+[request.getQueryParams()['override'] == 'templateOverride' || request.getParsedBody()['override'] == 'templateOverride']
     lib.viewConfig {
         templateRootPaths {
             15 = EXT:fluid_test/Resources/Private/TemplateOverride/Templates/
@@ -64,7 +64,7 @@ lib.viewConfig {
     }
 [end]
 
-[globalVar = GP:override = templateOverrideManual]
+[request.getQueryParams()['override'] == 'templateOverrideManual' || request.getParsedBody()['override'] == 'templateOverrideManual']
     lib.viewConfig {
         templateRootPaths {
             10 = EXT:fluid_test/Resources/Private/Override/Templates/
@@ -73,7 +73,7 @@ lib.viewConfig {
     }
 [end]
 
-[globalVar = GP:override = partialOverride]
+[request.getQueryParams()['override'] == 'partialOverride' || request.getParsedBody()['override'] == 'partialOverride']
     lib.viewConfig {
         partialRootPaths {
             15 = EXT:fluid_test/Resources/Private/PartialOverride/Partials/
@@ -82,7 +82,7 @@ lib.viewConfig {
     }
 [end]
 
-[globalVar = GP:override = partialOverrideManual]
+[request.getQueryParams()['override'] == 'partialOverrideManual' || request.getParsedBody()['override'] == 'partialOverrideManual']
     lib.viewConfig {
         partialRootPaths {
             10 = EXT:fluid_test/Resources/Private/Override/Partials/
@@ -91,7 +91,7 @@ lib.viewConfig {
     }
 [end]
 
-[globalVar = GP:override = layoutOverride]
+[request.getQueryParams()['override'] == 'layoutOverride' || request.getParsedBody()['override'] == 'layoutOverride']
     lib.viewConfig {
         layoutRootPaths {
             15 = EXT:fluid_test/Resources/Private/LayoutOverride/Layouts/
@@ -100,7 +100,7 @@ lib.viewConfig {
     }
 [end]
 
-[globalVar = GP:override = layoutOverrideManual]
+[request.getQueryParams()['override'] == 'layoutOverrideManual' || request.getParsedBody()['override'] == 'layoutOverrideManual']
     lib.viewConfig {
         layoutRootPaths {
             10 = EXT:fluid_test/Resources/Private/Override/Layouts/
@@ -109,7 +109,7 @@ lib.viewConfig {
     }
 [end]
 
-<INCLUDE_TYPOSCRIPT: source="FILE: ./FluidTemplateContentObject.ts" condition="[globalVar = GP:mode = fluidTemplate]">
-<INCLUDE_TYPOSCRIPT: source="FILE: ./ExtbasePlugin.ts" condition="[globalVar = GP:mode = plugin]">
-<INCLUDE_TYPOSCRIPT: source="FILE: ./ExtbaseController.ts" condition="[globalVar = GP:mode = controller]">
-<INCLUDE_TYPOSCRIPT: source="FILE: ./ExtbaseTwoPlugins.ts" condition="[globalVar = GP:mode = 2plugins]">
+<INCLUDE_TYPOSCRIPT: source="FILE: ./FluidTemplateContentObject.ts" condition="[request.getQueryParams()['mode'] == 'fluidTemplate' || request.getParsedBody()['mode'] == 'fluidTemplate']">
+<INCLUDE_TYPOSCRIPT: source="FILE: ./ExtbasePlugin.ts" condition="[request.getQueryParams()['mode'] == 'plugin' || request.getParsedBody()['mode'] == 'plugin']">
+<INCLUDE_TYPOSCRIPT: source="FILE: ./ExtbaseController.ts" condition="[request.getQueryParams()['mode'] == 'controller' || request.getParsedBody()['mode'] == 'controller']">
+<INCLUDE_TYPOSCRIPT: source="FILE: ./ExtbaseTwoPlugins.ts" condition="[request.getQueryParams()['mode'] == '2plugins' || request.getParsedBody()['mode'] == '2plugins']">
index 4f5d4ce..b164c5d 100644 (file)
@@ -7,10 +7,10 @@ page.10 {
     view < lib.viewConfig
 }
 
-[globalVar = GP:widgetConfig = new]
+[request.getQueryParams()['widgetConfig'] == 'new' || request.getParsedBody()['widgetConfig'] == 'new']
     page.10.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPath >
 [end]
 
-[globalVar = GP:widgetConfig = old]
+[request.getQueryParams()['widgetConfig'] == 'old' || request.getParsedBody()['widgetConfig'] == 'old']
     page.10.view.widget.TYPO3\CMS\Fluid\ViewHelpers\Widget\PaginateViewHelper.templateRootPaths >
 [end]
index 09e8993..775c1c2 100644 (file)
@@ -6,15 +6,15 @@ page.10 {
     vendorName = TYPO3Fluid
 }
 
-[globalVar = GP:pluginConfig = extensionKey]
+[request.getQueryParams()['pluginConfig'] == 'extensionKey' || request.getParsedBody()['pluginConfig'] == 'extensionKey']
     plugin.tx_fluidtest.view < lib.viewConfig
 [end]
 
-[globalVar = GP:pluginConfig = pluginName]
+[request.getQueryParams()['pluginConfig'] == 'pluginName' || request.getParsedBody()['pluginConfig'] == 'pluginName']
     plugin.tx_fluidtest_pi.view < lib.viewConfig
 [end]
 
-[globalVar = GP:pluginConfig = incomplete]
+[request.getQueryParams()['pluginConfig'] == 'incomplete' || request.getParsedBody()['pluginConfig'] == 'incomplete']
     plugin.tx_fluidtest_pi.view < lib.viewConfig
     plugin.tx_fluidtest_pi.view.partialRootPaths >
     plugin.tx_fluidtest_pi.view.layoutRootPaths >
index 13daf06..406ab09 100644 (file)
@@ -15,13 +15,9 @@ namespace TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching;
  * The TYPO3 project - inspiring people to share!
  */
 
-use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractConditionMatcher;
 use TYPO3\CMS\Core\Context\Context;
-use TYPO3\CMS\Core\Context\UserAspect;
 use TYPO3\CMS\Core\ExpressionLanguage\Resolver;
-use TYPO3\CMS\Core\Site\Entity\Site;
-use TYPO3\CMS\Core\Site\Entity\SiteLanguage;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
@@ -43,7 +39,7 @@ class ConditionMatcher extends AbstractConditionMatcher
     public function __construct(Context $context = null)
     {
         $this->context = $context ?? GeneralUtility::makeInstance(Context::class);
-        $this->rootline = $this->determineRootline();
+        $this->rootline = (array)$GLOBALS['TSFE']->tmpl->rootLine;
         $tree = new \stdClass();
         $tree->level = $this->rootline ? count($this->rootline) - 1 : 0;
         $tree->rootLine = $this->rootline;
@@ -62,295 +58,8 @@ class ConditionMatcher extends AbstractConditionMatcher
             [
                 'tree' => $tree,
                 'frontend' => $frontend,
-                'page' => $this->getPage(),
+                'page' => $GLOBALS['TSFE']->page ?? [],
             ]
         );
     }
-
-    /**
-     * Evaluates a TypoScript condition given as input,
-     * eg. "[browser=net][...(other conditions)...]"
-     *
-     * @param string $string The condition to match against its criteria.
-     * @return bool Whether the condition matched
-     * @see \TYPO3\CMS\Core\TypoScript\Parser\TypoScriptParser::parse()
-     * @throws \TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function evaluateCondition($string)
-    {
-        if ($this->strictSyntaxEnabled()) {
-            trigger_error('The old condition syntax will be removed in TYPO3 v10.0, use the new expression language. Used condition: [' . $string . '].', E_USER_DEPRECATED);
-        }
-
-        list($key, $value) = GeneralUtility::trimExplode('=', $string, false, 2);
-        $result = $this->evaluateConditionCommon($key, $value);
-        if (is_bool($result)) {
-            return $result;
-        }
-
-        switch ($key) {
-            case 'usergroup':
-                $groupList = $this->getGroupList();
-                // '0,-1' is the default usergroups when not logged in!
-                if ($groupList !== '0,-1') {
-                    $values = GeneralUtility::trimExplode(',', $value, true);
-                    foreach ($values as $test) {
-                        if ($test === '*' || GeneralUtility::inList($groupList, $test)) {
-                            return true;
-                        }
-                    }
-                }
-                break;
-            case 'treeLevel':
-                $values = GeneralUtility::trimExplode(',', $value, true);
-                $treeLevel = count($this->rootline) - 1;
-                foreach ($values as $test) {
-                    if ($test == $treeLevel) {
-                        return true;
-                    }
-                }
-                break;
-            case 'PIDupinRootline':
-            case 'PIDinRootline':
-                $values = GeneralUtility::trimExplode(',', $value, true);
-                if ($key === 'PIDinRootline' || !in_array($this->pageId, $values)) {
-                    foreach ($values as $test) {
-                        foreach ($this->rootline as $rlDat) {
-                            if ($rlDat['uid'] == $test) {
-                                return true;
-                            }
-                        }
-                    }
-                }
-                break;
-            case 'site':
-                $site = $this->getCurrentSite();
-                if ($site instanceof Site) {
-                    $values = GeneralUtility::trimExplode(',', $value, true);
-                    foreach ($values as $test) {
-                        $point = strcspn($test, '=');
-                        $testValue = substr($test, $point + 1);
-                        $testValue = trim($testValue);
-                        $theVarName = trim(substr($test, 0, $point));
-                        $methodName = 'get' . ucfirst($theVarName);
-                        if (method_exists($site, $methodName)) {
-                            $sitePropertyValue = call_user_func([$site, $methodName]);
-                            // loose check on purpose in order to check for integer values
-                            if ($testValue == $sitePropertyValue) {
-                                return true;
-                            }
-                        }
-                    }
-                }
-                break;
-            case 'siteLanguage':
-                $siteLanguage = $this->getCurrentSiteLanguage();
-                if ($siteLanguage instanceof SiteLanguage) {
-                    $values = GeneralUtility::trimExplode(',', $value, true);
-                    foreach ($values as $test) {
-                        $point = strcspn($test, '=');
-                        $testValue = substr($test, $point + 1);
-                        $testValue = trim($testValue);
-                        $theVarName = trim(substr($test, 0, $point));
-                        $methodName = 'get' . ucfirst($theVarName);
-                        if (method_exists($siteLanguage, $methodName)) {
-                            $languagePropertyValue = call_user_func([$siteLanguage, $methodName]);
-                            // loose check on purpose in order to check for integer values
-                            if ($testValue == $languagePropertyValue) {
-                                return true;
-                            }
-                        }
-                    }
-                }
-                break;
-            default:
-                $conditionResult = $this->evaluateCustomDefinedCondition($string);
-                if ($conditionResult !== null) {
-                    return $conditionResult;
-                }
-        }
-
-        return false;
-    }
-
-    /**
-     * Returns GP / ENV / TSFE / session vars
-     *
-     * @example GP:L
-     * @example TSFE:fe_user|sesData|foo|bar
-     * @example TSFE:id
-     * @example ENV:HTTP_HOST
-     *
-     * @param string $var Identifier
-     * @return mixed|null The value of the variable pointed to or NULL if variable did not exist
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getVariable($var)
-    {
-        $vars = explode(':', $var, 2);
-        $val = $this->getVariableCommon($vars);
-        if ($val === null) {
-            $splitAgain = explode('|', $vars[1], 2);
-            $k = trim($splitAgain[0]);
-            if ($k) {
-                switch ((string)trim($vars[0])) {
-                    case 'TSFE':
-                        if (strpos($vars[1], 'fe_user|sesData|') === 0) {
-                            trigger_error(
-                                'Condition on TSFE|fe_user|sesData is deprecated and will be removed in TYPO3 v10.0.',
-                                E_USER_DEPRECATED
-                            );
-                            $val = $this->getSessionVariable(substr($vars[1], 16));
-                        } else {
-                            $val = $this->getGlobal('TSFE|' . $vars[1]);
-                        }
-                        break;
-                    case 'session':
-                        $val = $this->getSessionVariable($vars[1]);
-                        break;
-                    default:
-                }
-            }
-        }
-        return $val;
-    }
-
-    /**
-     * Return variable from current frontend user session
-     *
-     * @param string $var Session key
-     * @return mixed|null The value of the variable pointed to or NULL if variable did not exist
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getSessionVariable(string $var)
-    {
-        $retVal = null;
-        $keyParts = explode('|', $var);
-        $sessionKey = array_shift($keyParts);
-        $tsfe = $this->getTypoScriptFrontendController();
-        if ($tsfe && is_object($tsfe->fe_user)) {
-            $retVal = $tsfe->fe_user->getSessionData($sessionKey);
-            foreach ($keyParts as $keyPart) {
-                if (is_object($retVal)) {
-                    $retVal = $retVal->{$keyPart};
-                } elseif (is_array($retVal)) {
-                    $retVal = $retVal[$keyPart];
-                } else {
-                    break;
-                }
-            }
-        }
-        return $retVal;
-    }
-
-    /**
-     * Get the usergroup list of the current user.
-     *
-     * @return string The usergroup list of the current user
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getGroupList(): string
-    {
-        /** @var UserAspect $userAspect */
-        $userAspect = $this->context->getAspect('frontend.user');
-        return implode(',', $userAspect->getGroupIds());
-    }
-
-    /**
-     * Determines the current page Id.
-     *
-     * @return int The current page Id
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function determinePageId()
-    {
-        return (int)($this->getTypoScriptFrontendController()->id ?? 0);
-    }
-
-    /**
-     * Gets the properties for the current page.
-     *
-     * @return array The properties for the current page.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getPage()
-    {
-        return is_array($this->getTypoScriptFrontendController()->page)
-            ? $this->getTypoScriptFrontendController()->page
-            : [];
-    }
-
-    /**
-     * Determines the rootline for the current page.
-     *
-     * @return array The rootline for the current page.
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function determineRootline()
-    {
-        return (array)$this->getTypoScriptFrontendController()->tmpl->rootLine;
-    }
-
-    /**
-     * Get the id of the current user.
-     *
-     * @return int The id of the current user
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getUserId(): int
-    {
-        $userAspect = $this->context->getAspect('frontend.user');
-        return $userAspect->get('id');
-    }
-
-    /**
-     * Determines if a user is logged in.
-     *
-     * @return bool Determines if a user is logged in
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function isUserLoggedIn(): bool
-    {
-        /** @var UserAspect $userAspect */
-        $userAspect = $this->context->getAspect('frontend.user');
-        return $userAspect->isLoggedIn();
-    }
-
-    /**
-     * @return \TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getTypoScriptFrontendController()
-    {
-        return $GLOBALS['TSFE'];
-    }
-
-    /**
-     * Returns the currently configured "site language" if a site is configured (= resolved) in the current request.
-     *
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getCurrentSiteLanguage(): ?SiteLanguage
-    {
-        if ($GLOBALS['TYPO3_REQUEST'] instanceof ServerRequestInterface
-            && $GLOBALS['TYPO3_REQUEST']->getAttribute('language') instanceof SiteLanguage) {
-            return $GLOBALS['TYPO3_REQUEST']->getAttribute('language');
-        }
-        return null;
-    }
-
-    /**
-     * Returns the currently configured site if a site is configured (= resolved) in the current request.
-     *
-     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0.
-     */
-    protected function getCurrentSite(): ?Site
-    {
-        if ($GLOBALS['TYPO3_REQUEST'] instanceof ServerRequestInterface
-            && $GLOBALS['TYPO3_REQUEST']->getAttribute('site') instanceof Site) {
-            return $GLOBALS['TYPO3_REQUEST']->getAttribute('site');
-        }
-        return null;
-    }
 }
diff --git a/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/frontend/Tests/Functional/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
new file mode 100644 (file)
index 0000000..b535eb6
--- /dev/null
@@ -0,0 +1,462 @@
+<?php
+declare(strict_types = 1);
+namespace TYPO3\CMS\Frontend\Tests\Functional\Configuration\TypoScript\ConditionMatching;
+
+/*
+ * 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 Prophecy\Argument;
+use TYPO3\CMS\Core\Context\Context;
+use TYPO3\CMS\Core\Context\UserAspect;
+use TYPO3\CMS\Core\Http\ServerRequest;
+use TYPO3\CMS\Core\Log\Logger;
+use TYPO3\CMS\Core\Site\Entity\Site;
+use TYPO3\CMS\Core\TypoScript\TemplateService;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
+use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
+use TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController;
+use TYPO3\CMS\Frontend\Page\PageRepository;
+use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
+
+/**
+ * Functional test for the ConditionMatcher of EXT:frontend
+ */
+class ConditionMatcherTest extends FunctionalTestCase
+{
+    /**
+     * Sets up this test case.
+     */
+    protected function setUp(): void
+    {
+        parent::setUp();
+
+        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
+
+        $this->importDataSet('PACKAGE:typo3/testing-framework/Resources/Core/Functional/Fixtures/pages.xml');
+        $this->setupFrontendController(3);
+    }
+
+    /**
+     * Tests whether usergroup comparison matches.
+     *
+     * @test
+     */
+    public function usergroupConditionMatchesSingleGroupId(): void
+    {
+        $this->setupFrontendUserContext([13]);
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[usergroup(13)]'));
+        $this->assertTrue($subject->match('[usergroup("13")]'));
+        $this->assertTrue($subject->match('[usergroup(\'13\')]'));
+    }
+
+    /**
+     * Tests whether usergroup comparison matches.
+     *
+     * @test
+     */
+    public function usergroupConditionMatchesMultipleUserGroupId(): void
+    {
+        $this->setupFrontendUserContext([13, 14, 15]);
+        $subject = $this->getConditionMatcher();
+        $this->assertFalse($subject->match('[usergroup(999,15,14,13)]'));
+        $this->assertTrue($subject->match('[usergroup("999,15,14,13")]'));
+        $this->assertTrue($subject->match('[usergroup(\'999,15,14,13\')]'));
+    }
+
+    /**
+     * Tests whether usergroup comparison matches.
+     *
+     * @test
+     */
+    public function usergroupConditionDoesNotMatchDefaulUserGroupIds(): void
+    {
+        $this->setupFrontendUserContext([0, -1]);
+        $subject = $this->getConditionMatcher();
+        $this->assertFalse($subject->match('[usergroup("0,-1")]'));
+        $this->assertFalse($subject->match('[usergroup(\'0,-1\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionMatchesAnyLoggedInUser(): void
+    {
+        $this->setupFrontendUserContext([13]);
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[loginUser("*")]'));
+        $this->assertTrue($subject->match('[loginUser(\'*\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionMatchesSingleLoggedInUser(): void
+    {
+        $this->setupFrontendUserContext([13, 14, 15]);
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[loginUser(13)]'));
+        $this->assertTrue($subject->match('[loginUser("13")]'));
+        $this->assertTrue($subject->match('[loginUser(\'13\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionMatchesMultipleLoggedInUsers(): void
+    {
+        $this->setupFrontendUserContext([13, 14, 15]);
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[loginUser("999,13")]'));
+        $this->assertTrue($subject->match('[loginUser(\'999,13\')]'));
+    }
+
+    /**
+     * Tests whether user comparison matches.
+     *
+     * @test
+     */
+    public function loginUserConditionDoesNotMatchIfNotUserIsLoggedId(): void
+    {
+        $this->setupFrontendUserContext();
+        $subject = $this->getConditionMatcher();
+        $this->assertFalse($subject->match('[loginUser("*")]'));
+        $this->assertTrue($subject->match('[loginUser("*") == false]'));
+        $this->assertFalse($subject->match('[loginUser("13")]'));
+        $this->assertFalse($subject->match('[loginUser(\'*\')]'));
+        $this->assertFalse($subject->match('[loginUser(\'13\')]'));
+    }
+
+    /**
+     * Tests whether user is not logged in
+     *
+     * @test
+     */
+    public function loginUserConditionMatchIfUserIsNotLoggedIn(): void
+    {
+        $this->setupFrontendUserContext();
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[loginUser(\'*\') == false]'));
+        $this->assertTrue($subject->match('[loginUser("*") == false]'));
+    }
+
+    /**
+     * Tests whether treeLevel comparison matches.
+     *
+     * @test
+     */
+    public function treeLevelConditionMatchesSingleValue(): void
+    {
+        $this->assertTrue($this->getConditionMatcher()->match('[tree.level == 2]'));
+    }
+
+    /**
+     * Tests whether treeLevel comparison matches.
+     *
+     * @test
+     */
+    public function treeLevelConditionMatchesMultipleValues(): void
+    {
+        $this->assertTrue($this->getConditionMatcher()->match('[tree.level in [999,998,2]]'));
+    }
+
+    /**
+     * Tests whether treeLevel comparison matches.
+     *
+     * @test
+     */
+    public function treeLevelConditionDoesNotMatchFaultyValue(): void
+    {
+        $this->assertFalse($this->getConditionMatcher()->match('[tree.level == 999]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in the previous rootline entries.
+     *
+     * @test
+     */
+    public function PIDupinRootlineConditionMatchesSinglePageIdInRootline(): void
+    {
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[2 in tree.rootLineIds]'));
+        $this->assertTrue($subject->match('["2" in tree.rootLineIds]'));
+        $this->assertTrue($subject->match('[\'2\' in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in the previous rootline entries.
+     *
+     * @test
+     */
+    public function PIDupinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
+    {
+        $this->assertFalse($this->getConditionMatcher()->match('[999 in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in all rootline entries.
+     *
+     * @test
+     */
+    public function PIDinRootlineConditionMatchesSinglePageIdInRootline(): void
+    {
+        $this->setupFrontendController(3);
+    }
+
+    /**
+     * Tests whether a page Id is found in all rootline entries.
+     *
+     * @test
+     */
+    public function PIDinRootlineConditionMatchesLastPageIdInRootline(): void
+    {
+        $this->assertTrue($this->getConditionMatcher()->match('[3 in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether a page Id is found in all rootline entries.
+     *
+     * @test
+     */
+    public function PIDinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
+    {
+        $this->assertFalse($this->getConditionMatcher()->match('[999 in tree.rootLineIds]'));
+    }
+
+    /**
+     * Tests whether the compatibility version can be evaluated.
+     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
+     *
+     * @test
+     */
+    public function compatVersionConditionMatchesOlderRelease(): void
+    {
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[compatVersion(7.0)]'));
+        $this->assertTrue($subject->match('[compatVersion("7.0")]'));
+        $this->assertTrue($subject->match('[compatVersion(\'7.0\')]'));
+    }
+
+    /**
+     * Tests whether the compatibility version can be evaluated.
+     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
+     *
+     * @test
+     */
+    public function compatVersionConditionMatchesSameRelease(): void
+    {
+        $this->assertTrue($this->getConditionMatcher()->match('[compatVersion(' . TYPO3_branch . ')]'));
+    }
+
+    /**
+     * Tests whether the compatibility version can be evaluated.
+     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
+     *
+     * @test
+     */
+    public function compatVersionConditionDoesNotMatchNewerRelease(): void
+    {
+        $subject = $this->getConditionMatcher();
+        $this->assertFalse($subject->match('[compatVersion(15.0)]'));
+        $this->assertFalse($subject->match('[compatVersion("15.0")]'));
+        $this->assertFalse($subject->match('[compatVersion(\'15.0\')]'));
+    }
+
+    /**
+     * Tests whether the generic fetching of variables works with the namespace 'TSFE'.
+     *
+     * @test
+     */
+    public function genericGetVariablesSucceedsWithNamespaceTSFE(): void
+    {
+        $GLOBALS['TSFE']->id = 1234567;
+        $GLOBALS['TSFE']->testSimpleObject = new \stdClass();
+        $GLOBALS['TSFE']->testSimpleObject->testSimpleVariable = 'testValue';
+
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[getTSFE().id == 1234567]'));
+        $this->assertTrue($subject->match('[getTSFE().testSimpleObject.testSimpleVariable == "testValue"]'));
+    }
+
+    /**
+     * Tests whether the generic fetching of variables works with the namespace 'session'.
+     *
+     * @test
+     */
+    public function genericGetVariablesSucceedsWithNamespaceSession(): void
+    {
+        $prophecy = $this->prophesize(FrontendUserAuthentication::class);
+        $prophecy->getSessionData(Argument::exact('foo'))->willReturn(['bar' => 1234567]);
+        $GLOBALS['TSFE']->fe_user = $prophecy->reveal();
+
+        $this->assertTrue($this->getConditionMatcher()->match('[session("foo|bar") == 1234567]'));
+    }
+
+    /**
+     * Tests whether the generic fetching of variables works with the namespace 'ENV'.
+     *
+     * @test
+     */
+    public function genericGetVariablesSucceedsWithNamespaceENV(): void
+    {
+        $testKey = $this->getUniqueId('test');
+        putenv($testKey . '=testValue');
+        $this->assertTrue($this->getConditionMatcher()->match('[getenv("' . $testKey . '") == "testValue"]'));
+    }
+
+    /**
+     * Tests whether any property of a site language matches the request
+     *
+     * @test
+     */
+    public function siteLanguageMatchesCondition(): void
+    {
+        $site = new Site('angelo', 13, [
+            'languages' => [
+                [
+                    'languageId' => 0,
+                    'title' => 'United States',
+                    'locale' => 'en_US.UTF-8',
+                ],
+                [
+                    'languageId' => 2,
+                    'title' => 'UK',
+                    'locale' => 'en_UK.UTF-8',
+                ]
+            ]
+        ]);
+        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[siteLanguage("locale") == "en_US.UTF-8"]'));
+        $this->assertTrue($subject->match('[siteLanguage("locale") in ["de_DE", "en_US.UTF-8"]]'));
+    }
+
+    /**
+     * Tests whether any property of a site language does NOT match the request
+     *
+     * @test
+     */
+    public function siteLanguageDoesNotMatchCondition(): void
+    {
+        $site = new Site('angelo', 13, [
+            'languages' => [
+                [
+                    'languageId' => 0,
+                    'title' => 'United States',
+                    'locale' => 'en_US.UTF-8',
+                ],
+                [
+                    'languageId' => 2,
+                    'title' => 'UK',
+                    'locale' => 'en_UK.UTF-8',
+                ]
+            ]
+        ]);
+        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
+        $subject = $this->getConditionMatcher();
+        $this->assertFalse($subject->match('[siteLanguage("locale") == "en_UK.UTF-8"]'));
+        $this->assertFalse($subject->match('[siteLanguage("locale") == "de_DE" && siteLanguage("title") == "UK"]'));
+    }
+
+    /**
+     * Tests whether any property of a site matches the request
+     *
+     * @test
+     */
+    public function siteMatchesCondition(): void
+    {
+        $site = new Site('angelo', 13, ['languages' => [], 'base' => 'https://typo3.org/']);
+        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
+        $subject = $this->getConditionMatcher();
+        $this->assertTrue($subject->match('[site("identifier") == "angelo"]'));
+        $this->assertTrue($subject->match('[site("rootPageId") == 13]'));
+        $this->assertTrue($subject->match('[site("base") == "https://typo3.org/"]'));
+    }
+
+    /**
+     * Tests whether any property of a site that does NOT match the request
+     *
+     * @test
+     */
+    public function siteDoesNotMatchCondition(): void
+    {
+        $site = new Site('angelo', 13, [
+            'languages' => [
+                [
+                    'languageId' => 0,
+                    'title' => 'United States',
+                    'locale' => 'en_US.UTF-8',
+                ],
+                [
+                    'languageId' => 2,
+                    'title' => 'UK',
+                    'locale' => 'en_UK.UTF-8',
+                ]
+            ]
+        ]);
+        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
+        $subject = $this->getConditionMatcher();
+        $this->assertFalse($subject->match('[site("identifier") == "berta"]'));
+        $this->assertFalse($subject->match('[site("rootPageId") == 14 && site("rootPageId") == 23]'));
+    }
+
+    /**
+     * @return ConditionMatcher
+     */
+    protected function getConditionMatcher(): ConditionMatcher
+    {
+        $conditionMatcher = new ConditionMatcher();
+        $conditionMatcher->setLogger($this->prophesize(Logger::class)->reveal());
+
+        return $conditionMatcher;
+    }
+
+    /**
+     * @param array $groups
+     */
+    protected function setupFrontendUserContext(array $groups = []): void
+    {
+        $frontendUser = new FrontendUserAuthentication();
+        $frontendUser->user['uid'] = 13;
+        $frontendUser->groupData['uid'] = $groups;
+
+        GeneralUtility::makeInstance(Context::class)->setAspect('frontend.user', new UserAspect($frontendUser, $groups));
+    }
+
+    /**
+     * @param int $pageId
+     */
+    protected function setupFrontendController(int $pageId): void
+    {
+        $GLOBALS['TSFE'] = GeneralUtility::makeInstance(
+            TypoScriptFrontendController::class,
+            null,
+            $pageId,
+            0
+        );
+        $GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class);
+        $GLOBALS['TSFE']->tmpl = GeneralUtility::makeInstance(TemplateService::class);
+        $GLOBALS['TSFE']->tmpl->rootLine = [
+            2 => ['uid' => 3, 'pid' => 2],
+            1 => ['uid' => 2, 'pid' => 1],
+            0 => ['uid' => 1, 'pid' => 0]
+        ];
+    }
+}
index cc80b96..f4c8d65 100644 (file)
@@ -1,18 +1,18 @@
 page = PAGE
 page.typeNum = 0
 
-[globalString = GP:noPageTitle = 1]
+[request.getQueryParams()['noPageTitle'] == 1 || request.getParsedBody()['noPageTitle'] == 1]
   config.noPageTitle = 1
-[globalString = GP:noPageTitle = 2]
+[request.getQueryParams()['noPageTitle'] == 2 || request.getParsedBody()['noPageTitle'] == 2]
   config.noPageTitle = 2
 [end]
 
-[globalString = GP:headerData = 1]
+[request.getQueryParams()['headerData'] == 1 || request.getParsedBody()['headerData'] == 1]
   page.headerData.100 = TEXT
   page.headerData.100.value = Header Data Title
   page.headerData.100.wrap = <title>|</title>
 [end]
 
-[globalString = GP:pageTitleTS = 1]
+[request.getQueryParams()['pageTitleTS'] == '1' || request.getParsedBody()['pageTitleTS'] == '1']
   config.pageTitle.case = upper
 [end]
index d448b80..639751b 100644 (file)
@@ -30,25 +30,25 @@ page {
   }
 }
 
-[globalString = GP:testAbsRefPrefix = auto]
+[request.getQueryParams()['testAbsRefPrefix'] == 'auto' || request.getParsedBody()['testAbsRefPrefix'] == 'auto']
   config.absRefPrefix = auto
-[globalString = GP:testAbsRefPrefix = absolute-with-host]
+[request.getQueryParams()['testAbsRefPrefix'] == 'absolute-with-host' || request.getParsedBody()['testAbsRefPrefix'] == 'absolute-with-host']
   config.absRefPrefix = http://localhost/
-[globalString = GP:testAbsRefPrefix = absolute-without-host]
+[request.getQueryParams()['testAbsRefPrefix'] == 'absolute-without-host' || request.getParsedBody()['testAbsRefPrefix'] == 'absolute-without-host']
   config.absRefPrefix = /
 [end]
 
-[globalString = GP:testCompressor = concatenate]
+[request.getQueryParams()['testCompressor'] == 'concatenate' || request.getParsedBody()['testCompressor'] == 'concatenate']
   config {
     concatenateCss = 1
     concatenateJs = 1
   }
-[globalString = GP:testCompressor = compress]
+[request.getQueryParams()['testCompressor'] == 'compress' || request.getParsedBody()['testCompressor'] == 'compress']
   config {
     compressCss = 1
     compressJs = 1
   }
-[globalString = GP:testCompressor = concatenate-and-compress]
+[request.getQueryParams()['testCompressor'] == 'concatenate-and-compress' || request.getParsedBody()['testCompressor'] == 'concatenate-and-compress']
   config {
     concatenateCss = 1
     concatenateJs = 1
diff --git a/typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/frontend/Tests/Unit/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
deleted file mode 100644 (file)
index 0429128..0000000
+++ /dev/null
@@ -1,492 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace TYPO3\CMS\Frontend\Tests\Unit\Configuration\TypoScript\ConditionMatching;
-
-/*
- * 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 Prophecy\Argument;
-use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
-use TYPO3\CMS\Core\Context\Context;
-use TYPO3\CMS\Core\Context\UserAspect;
-use TYPO3\CMS\Core\Http\ServerRequest;
-use TYPO3\CMS\Core\Log\Logger;
-use TYPO3\CMS\Core\Package\PackageInterface;
-use TYPO3\CMS\Core\Package\PackageManager;
-use TYPO3\CMS\Core\Site\Entity\Site;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
-use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-/**
- * Test case
- */
-class ConditionMatcherTest extends UnitTestCase
-{
-    /**
-     * @var ConditionMatcher
-     */
-    protected $subject;
-
-    /**
-     * @var string
-     */
-    protected $testGlobalNamespace;
-
-    /**
-     * @var bool Reset singletons
-     */
-    protected $resetSingletonInstances = true;
-
-    protected function setUp(): void
-    {
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
-        $cacheFrontendProphecy->has(Argument::any())->willReturn(false);
-        $cacheFrontendProphecy->set(Argument::any(), Argument::any())->willReturn(null);
-        $cacheManagerProphecy = $this->prophesize(CacheManager::class);
-        $cacheManagerProphecy->getCache('cache_core')->willReturn($cacheFrontendProphecy->reveal());
-        GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
-
-        $packageManagerProphecy = $this->prophesize(PackageManager::class);
-        $corePackageProphecy = $this->prophesize(PackageInterface::class);
-        $corePackageProphecy->getPackagePath()->willReturn(__DIR__ . '/../../../../../../../sysext/core/');
-        $packageManagerProphecy->getActivePackages()->willReturn([
-            $corePackageProphecy->reveal()
-        ]);
-        GeneralUtility::setSingletonInstance(PackageManager::class, $packageManagerProphecy->reveal());
-
-        $this->testGlobalNamespace = $this->getUniqueId('TEST');
-        $GLOBALS[$this->testGlobalNamespace] = [];
-        $GLOBALS['TSFE'] = new \stdClass();
-        $GLOBALS['TSFE']->page = [];
-        $GLOBALS['TSFE']->tmpl = new \stdClass();
-        $GLOBALS['TSFE']->tmpl->rootLine = [
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ];
-
-        $frontedUserAuthentication = $this->getMockBuilder(FrontendUserAuthentication::class)
-            ->setMethods(['dummy'])
-            ->getMock();
-
-        $frontedUserAuthentication->user['uid'] = 13;
-        $frontedUserAuthentication->groupData['uid'] = [14];
-        $GLOBALS['TSFE']->fe_user = $frontedUserAuthentication;
-        $this->getFreshConditionMatcher();
-    }
-
-    protected function getFreshConditionMatcher()
-    {
-        $this->subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect($GLOBALS['TSFE']->fe_user)
-        ]));
-        $this->subject->setLogger($this->prophesize(Logger::class)->reveal());
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesSingleGroupId(): void
-    {
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect(new FrontendUserAuthentication(), [13, 14, 15])
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertTrue($subject->match('[usergroup(13)]'));
-        $this->assertTrue($subject->match('[usergroup("13")]'));
-        $this->assertTrue($subject->match('[usergroup(\'13\')]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesMultipleUserGroupId(): void
-    {
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect(new FrontendUserAuthentication(), [13, 14, 15])
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertFalse($subject->match('[usergroup(999,15,14,13)]'));
-        $this->assertTrue($subject->match('[usergroup("999,15,14,13")]'));
-        $this->assertTrue($subject->match('[usergroup(\'999,15,14,13\')]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionDoesNotMatchDefaulUserGroupIds(): void
-    {
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect(new FrontendUserAuthentication(), [0, -1])
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertFalse($subject->match('[usergroup("0,-1")]'));
-        $this->assertFalse($subject->match('[usergroup(\'0,-1\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesAnyLoggedInUser(): void
-    {
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[loginUser("*")]'));
-        $this->assertTrue($this->subject->match('[loginUser(\'*\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesSingleLoggedInUser(): void
-    {
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[loginUser(13)]'));
-        $this->assertTrue($this->subject->match('[loginUser("13")]'));
-        $this->assertTrue($this->subject->match('[loginUser(\'13\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesMultipleLoggedInUsers(): void
-    {
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[loginUser("999,13")]'));
-        $this->assertTrue($this->subject->match('[loginUser(\'999,13\')]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionDoesNotMatchIfNotUserIsLoggedId(): void
-    {
-        $user = new FrontendUserAuthentication();
-        $user->user['uid'] = 13;
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect($user)
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertFalse($subject->match('[loginUser("*")]'));
-        $this->assertTrue($subject->match('[loginUser("*") == false]'));
-        $this->assertFalse($subject->match('[loginUser("13")]'));
-        $this->assertFalse($subject->match('[loginUser(\'*\')]'));
-        $this->assertFalse($subject->match('[loginUser(\'13\')]'));
-    }
-
-    /**
-     * Tests whether user is not logged in
-     *
-     * @test
-     */
-    public function loginUserConditionMatchIfUserIsNotLoggedIn(): void
-    {
-        $user = new FrontendUserAuthentication();
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect($user)
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertTrue($subject->match('[loginUser(\'*\') == false]'));
-        $this->assertTrue($subject->match('[loginUser("*") == false]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesSingleValue(): void
-    {
-        $this->assertTrue($this->subject->match('[tree.level == 2]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesMultipleValues(): void
-    {
-        $this->assertTrue($this->subject->match('[tree.level in [999,998,2]]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionDoesNotMatchFaultyValue(): void
-    {
-        $this->assertFalse($this->subject->match('[tree.level == 999]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesSinglePageIdInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[111 in tree.rootLineIds]'));
-        $this->assertTrue($this->subject->match('["111" in tree.rootLineIds]'));
-        $this->assertTrue($this->subject->match('[\'111\' in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[999 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesSinglePageIdInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[111 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesLastPageIdInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[121 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->assertFalse($this->subject->match('[999 in tree.rootLineIds]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesOlderRelease(): void
-    {
-        $this->assertTrue($this->subject->match('[compatVersion(7.0)]'));
-        $this->assertTrue($this->subject->match('[compatVersion("7.0")]'));
-        $this->assertTrue($this->subject->match('[compatVersion(\'7.0\')]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesSameRelease(): void
-    {
-        $this->assertTrue($this->subject->match('[compatVersion(' . TYPO3_branch . ')]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionDoesNotMatchNewerRelease(): void
-    {
-        $this->assertFalse($this->subject->match('[compatVersion(15.0)]'));
-        $this->assertFalse($this->subject->match('[compatVersion("15.0")]'));
-        $this->assertFalse($this->subject->match('[compatVersion(\'15.0\')]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'TSFE'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceTSFE(): void
-    {
-        $GLOBALS['TSFE']->id = 1234567;
-        $GLOBALS['TSFE']->testSimpleObject = new \stdClass();
-        $GLOBALS['TSFE']->testSimpleObject->testSimpleVariable = 'testValue';
-
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[getTSFE().id == 1234567]'));
-        $this->assertTrue($this->subject->match('[getTSFE().testSimpleObject.testSimpleVariable == "testValue"]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'session'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceSession(): void
-    {
-        $prophecy = $this->prophesize(FrontendUserAuthentication::class);
-        $prophecy->getSessionData(Argument::exact('foo'))->willReturn(['bar' => 1234567]);
-        $GLOBALS['TSFE']->fe_user = $prophecy->reveal();
-
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[session("foo|bar") == 1234567]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'ENV'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceENV(): void
-    {
-        $testKey = $this->getUniqueId('test');
-        putenv($testKey . '=testValue');
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[getenv("' . $testKey . '") == "testValue"]'));
-    }
-
-    /**
-     * Tests whether any property of a site language matches the request
-     *
-     * @test
-     */
-    public function siteLanguageMatchesCondition(): void
-    {
-        $site = new Site('angelo', 13, [
-            'languages' => [
-                [
-                    'languageId' => 0,
-                    'title' => 'United States',
-                    'locale' => 'en_US.UTF-8',
-                ],
-                [
-                    'languageId' => 2,
-                    'title' => 'UK',
-                    'locale' => 'en_UK.UTF-8',
-                ]
-            ]
-        ]);
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[siteLanguage("locale") == "en_US.UTF-8"]'));
-        $this->assertTrue($this->subject->match('[siteLanguage("locale") in ["de_DE", "en_US.UTF-8"]]'));
-    }
-
-    /**
-     * Tests whether any property of a site language does NOT match the request
-     *
-     * @test
-     */
-    public function siteLanguageDoesNotMatchCondition(): void
-    {
-        $site = new Site('angelo', 13, [
-            'languages' => [
-                [
-                    'languageId' => 0,
-                    'title' => 'United States',
-                    'locale' => 'en_US.UTF-8',
-                ],
-                [
-                    'languageId' => 2,
-                    'title' => 'UK',
-                    'locale' => 'en_UK.UTF-8',
-                ]
-            ]
-        ]);
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[siteLanguage("locale") == "en_UK.UTF-8"]'));
-        $this->assertFalse($this->subject->match('[siteLanguage("locale") == "de_DE" && siteLanguage("title") == "UK"]'));
-    }
-
-    /**
-     * Tests whether any property of a site matches the request
-     *
-     * @test
-     */
-    public function siteMatchesCondition(): void
-    {
-        $site = new Site('angelo', 13, ['languages' => [], 'base' => 'https://typo3.org/']);
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[site("identifier") == "angelo"]'));
-        $this->assertTrue($this->subject->match('[site("rootPageId") == 13]'));
-        $this->assertTrue($this->subject->match('[site("base") == "https://typo3.org/"]'));
-    }
-
-    /**
-     * Tests whether any property of a site that does NOT match the request
-     *
-     * @test
-     */
-    public function siteDoesNotMatchCondition(): void
-    {
-        $site = new Site('angelo', 13, [
-            'languages' => [
-                [
-                    'languageId' => 0,
-                    'title' => 'United States',
-                    'locale' => 'en_US.UTF-8',
-                ],
-                [
-                    'languageId' => 2,
-                    'title' => 'UK',
-                    'locale' => 'en_UK.UTF-8',
-                ]
-            ]
-        ]);
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[site("identifier") == "berta"]'));
-        $this->assertFalse($this->subject->match('[site("rootPageId") == 14 && site("rootPageId") == 23]'));
-    }
-}
diff --git a/typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php b/typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/ConditionMatcherTest.php
deleted file mode 100644 (file)
index 7c74ec3..0000000
+++ /dev/null
@@ -1,909 +0,0 @@
-<?php
-declare(strict_types = 1);
-namespace TYPO3\CMS\Frontend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching;
-
-/*
- * 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 Prophecy\Argument;
-use TYPO3\CMS\Core\Cache\CacheManager;
-use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
-use TYPO3\CMS\Core\Configuration\TypoScript\Exception\InvalidTypoScriptConditionException;
-use TYPO3\CMS\Core\Context\Context;
-use TYPO3\CMS\Core\Context\UserAspect;
-use TYPO3\CMS\Core\Http\ServerRequest;
-use TYPO3\CMS\Core\Log\Logger;
-use TYPO3\CMS\Core\Package\PackageInterface;
-use TYPO3\CMS\Core\Package\PackageManager;
-use TYPO3\CMS\Core\Site\Entity\Site;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
-use TYPO3\CMS\Frontend\Configuration\TypoScript\ConditionMatching\ConditionMatcher;
-use TYPO3\CMS\Frontend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching\Fixtures\TestConditionException;
-use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
-
-/**
- * Test case
- */
-class ConditionMatcherTest extends UnitTestCase
-{
-    /**
-     * @var ConditionMatcher
-     */
-    protected $subject;
-
-    /**
-     * @var string
-     */
-    protected $testGlobalNamespace;
-
-    /**
-     * @var bool Reset singletons
-     */
-    protected $resetSingletonInstances = true;
-
-    protected function setUp(): void
-    {
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $cacheFrontendProphecy = $this->prophesize(FrontendInterface::class);
-        $cacheFrontendProphecy->has(Argument::any())->willReturn(false);
-        $cacheFrontendProphecy->set(Argument::any(), Argument::any())->willReturn(null);
-        $cacheManagerProphecy = $this->prophesize(CacheManager::class);
-        $cacheManagerProphecy->getCache('cache_core')->willReturn($cacheFrontendProphecy->reveal());
-        GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
-
-        $packageManagerProphecy = $this->prophesize(PackageManager::class);
-        $corePackageProphecy = $this->prophesize(PackageInterface::class);
-        $corePackageProphecy->getPackagePath()->willReturn(__DIR__ . '/../../../../../../../sysext/core/');
-        $packageManagerProphecy->getActivePackages()->willReturn([
-            $corePackageProphecy->reveal()
-        ]);
-        GeneralUtility::setSingletonInstance(PackageManager::class, $packageManagerProphecy->reveal());
-
-        $this->testGlobalNamespace = $this->getUniqueId('TEST');
-        $GLOBALS[$this->testGlobalNamespace] = [];
-        $GLOBALS['TSFE'] = new \stdClass();
-        $GLOBALS['TSFE']->page = [];
-        $GLOBALS['TSFE']->tmpl = new \stdClass();
-        $GLOBALS['TSFE']->tmpl->rootLine = [
-            2 => ['uid' => 121, 'pid' => 111],
-            1 => ['uid' => 111, 'pid' => 101],
-            0 => ['uid' => 101, 'pid' => 0]
-        ];
-
-        $frontedUserAuthentication = $this->getMockBuilder(FrontendUserAuthentication::class)
-            ->setMethods(['dummy'])
-            ->getMock();
-
-        $frontedUserAuthentication->user['uid'] = 13;
-        $frontedUserAuthentication->groupData['uid'] = [14];
-        $GLOBALS['TSFE']->fe_user = $frontedUserAuthentication;
-        $this->getFreshConditionMatcher();
-    }
-
-    protected function getFreshConditionMatcher()
-    {
-        $this->subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect($GLOBALS['TSFE']->fe_user)
-        ]));
-        $this->subject->setLogger($this->prophesize(Logger::class)->reveal());
-    }
-
-    /**
-     * Tests whether a faulty expression fails.
-     *
-     * @test
-     */
-    public function simulateDisabledMatchAllConditionsFailsOnFaultyExpression(): void
-    {
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[nullCondition = This expression would return FALSE in general]'));
-    }
-
-    /**
-     * Tests whether simulating positive matches for all conditions succeeds.
-     *
-     * @test
-     */
-    public function simulateEnabledMatchAllConditionsSucceeds(): void
-    {
-        $this->getFreshConditionMatcher();
-        $this->subject->setSimulateMatchResult(true);
-        $this->assertTrue($this->subject->match('[nullCondition = This expression would return FALSE in general]'));
-    }
-
-    /**
-     * Tests whether simulating positive matches for specific conditions succeeds.
-     *
-     * @test
-     */
-    public function simulateEnabledMatchSpecificConditionsSucceeds(): void
-    {
-        $this->getFreshConditionMatcher();
-        $testCondition = '[' . $this->getUniqueId('test') . ' = Any condition to simulate a positive match]';
-        $this->subject->setSimulateMatchConditions([$testCondition]);
-        $this->assertTrue($this->subject->match($testCondition));
-    }
-
-    /**
-     * Tests whether the language comparison matches.
-     *
-     * @test
-     */
-    public function languageConditionMatchesSingleLanguageExpression(): void
-    {
-        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[language = *de*]'));
-        $this->assertTrue($this->subject->match('[language = *de-de*]'));
-    }
-
-    /**
-     * Tests whether the language comparison matches.
-     *
-     * @test
-     */
-    public function languageConditionMatchesMultipleLanguagesExpression(): void
-    {
-        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[language = *en*,*de*]'));
-        $this->assertTrue($this->subject->match('[language = *en-us*,*de-de*]'));
-    }
-
-    /**
-     * Tests whether the language comparison matches.
-     *
-     * @test
-     */
-    public function languageConditionMatchesCompleteLanguagesExpression(): void
-    {
-        $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-de,de;q=0.8,en-us;q=0.5,en;q=0.3';
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[language = de-de,de;q=0.8,en-us;q=0.5,en;q=0.3]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesSingleGroupId(): void
-    {
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect(new FrontendUserAuthentication(), [13, 14, 15])
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertTrue($subject->match('[usergroup = 13]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionMatchesMultipleUserGroupId(): void
-    {
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect(new FrontendUserAuthentication(), [13, 14, 15])
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertTrue($subject->match('[usergroup = 999,15,14,13]'));
-    }
-
-    /**
-     * Tests whether usergroup comparison matches.
-     *
-     * @test
-     */
-    public function usergroupConditionDoesNotMatchDefaulUserGroupIds(): void
-    {
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect(new FrontendUserAuthentication(), [0, -1])
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertFalse($subject->match('[usergroup = 0,-1]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesAnyLoggedInUser(): void
-    {
-        $this->getFreshConditionMatcher();
-        // @TODO: not work yet, looks like test setup issue
-        $this->assertTrue($this->subject->match('[loginUser = *]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesSingleLoggedInUser(): void
-    {
-        $this->getFreshConditionMatcher();
-        // @TODO: not work yet, looks like test setup issue
-        $this->assertTrue($this->subject->match('[loginUser = 13]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionMatchesMultipleLoggedInUsers(): void
-    {
-        $this->getFreshConditionMatcher();
-        // @TODO: not work yet, looks like test setup issue
-        $this->assertTrue($this->subject->match('[loginUser = 999,13]'));
-    }
-
-    /**
-     * Tests whether user comparison matches.
-     *
-     * @test
-     */
-    public function loginUserConditionDoesNotMatchIfNotUserIsLoggedId(): void
-    {
-        $user = new FrontendUserAuthentication();
-        $user->user['uid'] = 13;
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect($user)
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertFalse($subject->match('[loginUser = *]'));
-        $this->assertFalse($subject->match('[loginUser = 13]'));
-    }
-
-    /**
-     * Tests whether user is not logged in
-     *
-     * @test
-     */
-    public function loginUserConditionMatchIfUserIsNotLoggedIn(): void
-    {
-        $user = new FrontendUserAuthentication();
-        $subject = new ConditionMatcher(new Context([
-            'frontend.user' => new UserAspect($user)
-        ]));
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $subject->setLogger($loggerProphecy->reveal());
-        $this->assertTrue($subject->match('[loginUser = ]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnEqualExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 = 10]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 = 10.1]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 == 10]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 == 10.1]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnEqualExpressionWithMultipleValues(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 = 10|20|30]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 = 10.1|20.2|30.3]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:20 = 10|20|30]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:20.2 = 10.1|20.2|30.3]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 == 10|20|30]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 == 10.1|20.2|30.3]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:20 == 10|20|30]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:20.2 == 10.1|20.2|30.3]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnNotEqualExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 != 20]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 != 10.2]'));
-    }
-
-    /**
-     * Tests whether numerical comparison does not match.
-     *
-     * @test
-     */
-    public function globalVarConditionDoesNotMatchOnNotEqualExpression(): void
-    {
-        $this->assertFalse($this->subject->match('[globalVar = LIT:10 != 10]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnNotEqualExpressionWithMultipleValues(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 != 20|30]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 != 10.2|20.3]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnLowerThanExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 < 20]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 < 10.2]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnLowerThanOrEqualExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 <= 10]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 <= 20]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 <= 10.1]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 <= 10.2]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnGreaterThanExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:20 > 10]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.2 > 10.1]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnGreaterThanOrEqualExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10 >= 10]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:20 >= 10]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.1 >= 10.1]'));
-        $this->assertTrue($this->subject->match('[globalVar = LIT:10.2 >= 10.1]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnEmptyExpressionWithNoValueSet(): void
-    {
-        $testKey = $this->getUniqueId('test');
-        $this->assertTrue($this->subject->match('[globalVar = GP:' . $testKey . '=]'));
-        $this->assertTrue($this->subject->match('[globalVar = GP:' . $testKey . ' = ]'));
-    }
-
-    /**
-     * Tests whether numerical comparison matches.
-     *
-     * @test
-     */
-    public function globalVarConditionDoesNotMatchOnEmptyExpressionWithValueSetToZero(): void
-    {
-        $testKey = $this->getUniqueId('test');
-        $_GET = [];
-        $_POST = [$testKey => 0];
-        $this->assertFalse($this->subject->match('[globalVar = GP:' . $testKey . '=]'));
-        $this->assertFalse($this->subject->match('[globalVar = GP:' . $testKey . ' = ]'));
-    }
-
-    /**
-     * Tests whether an array with zero as key matches its value
-     *
-     * @test
-     */
-    public function globalVarConditionMatchesOnArrayExpressionWithZeroAsKey(): void
-    {
-        $testKey = $this->getUniqueId('test');
-        $testValue = '1';
-        $_GET = [];
-        $_POST = [$testKey => ['0' => $testValue]];
-        $this->assertTrue($this->subject->match('[globalVar = GP:' . $testKey . '|0=' . $testValue . ']'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesOnEqualExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3.Test.Condition]'));
-        $this->assertFalse($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesOnEmptyExpressionWithValueSetToEmptyString(): void
-    {
-        $testKey = $this->getUniqueId('test');
-        $_GET = [];
-        $_POST = [$testKey => ''];
-        $this->assertTrue($this->subject->match('[globalString = GP:' . $testKey . '=]'));
-        $this->assertTrue($this->subject->match('[globalString = GP:' . $testKey . ' = ]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesOnEmptyLiteralExpressionWithValueSetToEmptyString(): void
-    {
-        $this->assertTrue($this->subject->match('[globalString = LIT:=]'));
-        $this->assertTrue($this->subject->match('[globalString = LIT: = ]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesWildcardExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3?Test?Condition]'));
-        $this->assertTrue($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3.T*t.Condition]'));
-        $this->assertTrue($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = TYPO3?T*t?Condition]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesRegularExpression(): void
-    {
-        $this->assertTrue($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = /^[A-Za-z3.]+$/]'));
-        $this->assertTrue($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = /^TYPO3\\..+Condition$/]'));
-        $this->assertFalse($this->subject->match('[globalString = LIT:TYPO3.Test.Condition = /^FALSE/]'));
-    }
-
-    /**
-     * Tests whether string comparison matches.
-     *
-     * @test
-     */
-    public function globalStringConditionMatchesEmptyRegularExpression(): void
-    {
-        $testKey = $this->getUniqueId('test');
-        $GLOBALS['_SERVER'][$testKey] = '';
-        $this->assertTrue($this->subject->match('[globalString = _SERVER|' . $testKey . ' = /^$/]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesSingleValue(): void
-    {
-        $this->assertTrue($this->subject->match('[treeLevel = 2]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionMatchesMultipleValues(): void
-    {
-        $this->assertTrue($this->subject->match('[treeLevel = 999,998,2]'));
-    }
-
-    /**
-     * Tests whether treeLevel comparison matches.
-     *
-     * @test
-     */
-    public function treeLevelConditionDoesNotMatchFaultyValue(): void
-    {
-        $this->assertFalse($this->subject->match('[treeLevel = 999]'));
-    }
-
-    /**
-     * @return array
-     */
-    public function pageDataProvider(): array
-    {
-        return [
-            '[page|layout = 0]' => ['[page|layout = 0]', true],
-            '[page|layout = 1]' => ['[page|layout = 1]', false],
-            '[page|title = Foo]' => ['[page|title = Foo]', true],
-        ];
-    }
-
-    /**
-     * @test
-     * @dataProvider pageDataProvider
-     * @param string $expression
-     * @param bool $expected
-     */
-    public function checkConditionMatcherForPage(string $expression, bool $expected): void
-    {
-        $GLOBALS['TSFE']->page = ['title' => 'Foo', 'layout' => 0];
-        $this->getFreshConditionMatcher();
-        $this->assertSame($expected, $this->subject->match($expression));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesSinglePageIdInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[PIDupinRootline = 111]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionMatchesMultiplePageIdsInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[PIDupinRootline = 999,111,101]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[PIDupinRootline = 999]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in the previous rootline entries.
-     *
-     * @test
-     */
-    public function PIDupinRootlineConditionDoesNotMatchLastPageIdInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[PIDupinRootline = 121]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesSinglePageIdInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[PIDinRootline = 111]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesMultiplePageIdsInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[PIDinRootline = 999,111,101]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionMatchesLastPageIdInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[PIDinRootline = 121]'));
-    }
-
-    /**
-     * Tests whether a page Id is found in all rootline entries.
-     *
-     * @test
-     */
-    public function PIDinRootlineConditionDoesNotMatchPageIdNotInRootline(): void
-    {
-        $GLOBALS['TSFE']->id = 121;
-        $this->assertFalse($this->subject->match('[PIDinRootline = 999]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesOlderRelease(): void
-    {
-        $this->assertTrue($this->subject->match('[compatVersion = 7.0]'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionMatchesSameRelease(): void
-    {
-        $this->assertTrue($this->subject->match('[compatVersion = ' . TYPO3_branch . ']'));
-    }
-
-    /**
-     * Tests whether the compatibility version can be evaluated.
-     * (e.g. 7.9 is compatible to 7.0 but not to 15.0)
-     *
-     * @test
-     */
-    public function compatVersionConditionDoesNotMatchNewerRelease(): void
-    {
-        $this->assertFalse($this->subject->match('[compatVersion = 15.0]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'GP'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceGP(): void
-    {
-        $_GET = ['testGet' => 'getTest'];
-        $_POST = ['testPost' => 'postTest'];
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[globalString = GP:testGet = getTest]'));
-        $this->assertTrue($this->subject->match('[globalString = GP:testPost = postTest]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'TSFE'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceTSFE(): void
-    {
-        $GLOBALS['TSFE']->id = 1234567;
-        $GLOBALS['TSFE']->testSimpleObject = new \stdClass();
-        $GLOBALS['TSFE']->testSimpleObject->testSimpleVariable = 'testValue';
-
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[globalString = TSFE:id = 1234567]'));
-        $this->assertTrue($this->subject->match('[globalString = TSFE:testSimpleObject|testSimpleVariable = testValue]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'session'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceSession(): void
-    {
-        $prophecy = $this->prophesize(FrontendUserAuthentication::class);
-        $prophecy->getSessionData(Argument::exact('foo'))->willReturn(['bar' => 1234567]);
-        $GLOBALS['TSFE']->fe_user = $prophecy->reveal();
-
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[globalString = session:foo|bar = 1234567]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'ENV'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceENV(): void
-    {
-        $testKey = $this->getUniqueId('test');
-        putenv($testKey . '=testValue');
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[globalString = ENV:' . $testKey . ' = testValue]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with the namespace 'IENV'.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithNamespaceIENV(): void
-    {
-        $_SERVER['HTTP_HOST'] = GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY') . ':1234567';
-        // getIndpEnv() is polluted after above call, clear cache to have it recalculate for subject execption
-        GeneralUtility::flushInternalRuntimeCaches();
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[globalString = IENV:TYPO3_PORT = 1234567]'));
-    }
-
-    /**
-     * Tests whether the generic fetching of variables works with any global namespace.
-     *
-     * @test
-     */
-    public function genericGetVariablesSucceedsWithAnyGlobalNamespace(): void
-    {
-        $GLOBALS[$this->testGlobalNamespace] = [
-            'first' => 'testFirst',
-            'second' => ['third' => 'testThird']
-        ];
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[globalString = ' . $this->testGlobalNamespace . '|first = testFirst]'));
-        $this->assertTrue($this->subject->match('[globalString = ' . $this->testGlobalNamespace . '|second|third = testThird]'));
-    }
-
-    /**
-     * Tests whether any property of a site language matches the request
-     *
-     * @test
-     */
-    public function siteLanguageMatchesCondition(): void
-    {
-        $site = new Site('angelo', 13, [
-            'languages' => [
-                [
-                    'languageId' => 0,
-                    'title' => 'United States',
-                    'locale' => 'en_US.UTF-8',
-                ],
-                [
-                    'languageId' => 2,
-                    'title' => 'UK',
-                    'locale' => 'en_UK.UTF-8',
-                ]
-            ]
-        ]);
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[siteLanguage = locale = en_US.UTF-8]'));
-        $this->assertTrue($this->subject->match('[siteLanguage = locale = de_DE, locale = en_US.UTF-8]'));
-    }
-
-    /**
-     * Tests whether any property of a site language does NOT match the request
-     *
-     * @test
-     */
-    public function siteLanguageDoesNotMatchCondition(): void
-    {
-        $site = new Site('angelo', 13, [
-            'languages' => [
-                [
-                    'languageId' => 0,
-                    'title' => 'United States',
-                    'locale' => 'en_US.UTF-8',
-                ],
-                [
-                    'languageId' => 2,
-                    'title' => 'UK',
-                    'locale' => 'en_UK.UTF-8',
-                ]
-            ]
-        ]);
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('language', $site->getLanguageById(0));
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[siteLanguage = locale = en_UK.UTF-8]'));
-        $this->assertFalse($this->subject->match('[siteLanguage = locale = de_DE, title = UK]'));
-    }
-
-    /**
-     * Tests whether any property of a site matches the request
-     *
-     * @test
-     */
-    public function siteMatchesCondition(): void
-    {
-        $site = new Site('angelo', 13, ['languages' => [], 'base' => 'https://typo3.org/']);
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
-        $this->getFreshConditionMatcher();
-        $this->assertTrue($this->subject->match('[site = identifier = angelo]'));
-        $this->assertTrue($this->subject->match('[site = rootPageId = 13]'));
-        $this->assertTrue($this->subject->match('[site = base = https://typo3.org/]'));
-    }
-
-    /**
-     * Tests whether any property of a site that does NOT match the request
-     *
-     * @test
-     */
-    public function siteDoesNotMatchCondition(): void
-    {
-        $site = new Site('angelo', 13, [
-            'languages' => [
-                [
-                    'languageId' => 0,
-                    'title' => 'United States',
-                    'locale' => 'en_US.UTF-8',
-                ],
-                [
-                    'languageId' => 2,
-                    'title' => 'UK',
-                    'locale' => 'en_UK.UTF-8',
-                ]
-            ]
-        ]);
-        $GLOBALS['TYPO3_REQUEST'] = new ServerRequest();
-        $GLOBALS['TYPO3_REQUEST'] = $GLOBALS['TYPO3_REQUEST']->withAttribute('site', $site);
-        $this->getFreshConditionMatcher();
-        $this->assertFalse($this->subject->match('[site = identifier = berta]'));
-        $this->assertFalse($this->subject->match('[site = rootPageId = 14, rootPageId=23]'));
-    }
-
-    /**
-     * @test
-     */
-    public function matchThrowsExceptionIfConditionClassDoesNotInheritFromAbstractCondition(): void
-    {
-        $this->expectException(InvalidTypoScriptConditionException::class);
-        $this->expectExceptionCode(1410286153);
-        $this->getFreshConditionMatcher();
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $this->subject->setLogger($loggerProphecy->reveal());
-        $this->subject->match('[stdClass = foo]');
-    }
-
-    /**
-     * @test
-     */
-    public function matchCallsTestConditionAndHandsOverParameters(): void
-    {
-        $this->expectException(TestConditionException::class);
-        $this->expectExceptionCode(1411581139);
-        $this->getFreshConditionMatcher();
-        $loggerProphecy = $this->prophesize(Logger::class);
-        $this->subject->setLogger($loggerProphecy->reveal());
-        $this->subject->match('[TYPO3\\CMS\\Frontend\\Tests\\UnitDeprecated\\Configuration\\TypoScript\\ConditionMatching\\Fixtures\\TestCondition = 7, != 6]');
-    }
-}
diff --git a/typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestCondition.php b/typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestCondition.php
deleted file mode 100644 (file)
index d2b6a3f..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching\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!
- */
-
-/**
- * Fixture for custom conditions
- */
-class TestCondition extends \TYPO3\CMS\Core\Configuration\TypoScript\ConditionMatching\AbstractCondition
-{
-    /**
-     * Test matcher tests input parameters.
-     *
-     * @param array $conditionParameters
-     * @throws TestConditionException
-     * @return bool
-     */
-    public function matchCondition(array $conditionParameters)
-    {
-        // Throw an exception if everything is fine, this exception is *expected* in the according unit test
-        if ($conditionParameters[0] === '= 7' && $conditionParameters[1] === '!= 6') {
-            throw new TestConditionException('All Ok', 1411581139);
-        }
-    }
-}
diff --git a/typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestConditionException.php b/typo3/sysext/frontend/Tests/UnitDeprecated/Configuration/TypoScript/ConditionMatching/Fixtures/TestConditionException.php
deleted file mode 100644 (file)
index 86bef22..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\Tests\UnitDeprecated\Configuration\TypoScript\ConditionMatching\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!
- */
-
-/**
- * Exception thrown by TestCondition
- */
-class TestConditionException extends \Exception
-{
-}