Revert "[FEATURE] Support feature toggle in expression language" 78/58878/2
authorAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 9 Nov 2018 11:14:14 +0000 (13:14 +0200)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Fri, 9 Nov 2018 11:14:29 +0000 (12:14 +0100)
This reverts commit c0d321c2c0f0e4eb8b839a83a787e104183092da.

Reason for revert: this was a feature merged before branching, I apologize.

Change-Id: I36125cac4d56bb0d87f6ba3a76093af6201bee4c
Reviewed-on: https://review.typo3.org/58878
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/sysext/core/Classes/ExpressionLanguage/FunctionsProvider/DefaultFunctionsProvider.php
typo3/sysext/core/Documentation/Changelog/master/Feature-86881-SupportOfFeaturesInExpressionLanguage.rst [deleted file]
typo3/sysext/core/Tests/Unit/Configuration/TypoScript/ConditionMatching/AbstractConditionMatcherTest.php

index a20ee9e..ed9dde3 100644 (file)
@@ -17,7 +17,6 @@ namespace TYPO3\CMS\Core\ExpressionLanguage\FunctionsProvider;
 
 use Symfony\Component\ExpressionLanguage\ExpressionFunction;
 use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
-use TYPO3\CMS\Core\Configuration\Features;
 use TYPO3\CMS\Core\Context\Context;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Core\Utility\StringUtility;
@@ -40,7 +39,6 @@ class DefaultFunctionsProvider implements ExpressionFunctionProviderInterface
             $this->getLikeFunction(),
             $this->getEnvFunction(),
             $this->getDateFunction(),
-            $this->getFeatureToggleFunction(),
         ];
     }
 
@@ -98,14 +96,4 @@ class DefaultFunctionsProvider implements ExpressionFunctionProviderInterface
                 ->getAspect('date')->getDateTime()->format($format);
         });
     }
-
-    protected function getFeatureToggleFunction(): ExpressionFunction
-    {
-        return new ExpressionFunction('feature', function () {
-            // Not implemented, we only use the evaluator
-        }, function ($arguments, $featureName) {
-            return GeneralUtility::makeInstance(Features::class)
-                ->isFeatureEnabled($featureName);
-        });
-    }
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-86881-SupportOfFeaturesInExpressionLanguage.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-86881-SupportOfFeaturesInExpressionLanguage.rst
deleted file mode 100644 (file)
index 9a5e625..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-.. include:: ../../Includes.txt
-
-============================================================
-Feature: #86881 - Support of Features in expression language
-============================================================
-
-See :issue:`86881`
-
-Description
-===========
-
-With #83429 the core got support for feature toggles including a small API.
-This patch adds support for feature toggle check in the symfony expression language DefaultFunctionProvider.
-With the new function :typoscript:`feature()` the feature toggle can be checked.
-
-.. code-block:: typoscript
-
-   [feature("TypoScript.strictSyntax")]
-   # This condition matches if the feature toggle "TypoScript.strictSyntax" is true
-   [END]
-
-   [feature("TypoScript.strictSyntax") === false]
-   # This condition matches if the feature toggle "TypoScript.strictSyntax" is false
-   [END]
-
-
-.. index:: Backend, Frontend, TypoScript, ext:core
index 3828e5e..358acb0 100644 (file)
@@ -171,47 +171,6 @@ class AbstractConditionMatcherTest extends UnitTestCase
     }
 
     /**
-     * @test
-     */
-    public function checkConditionMatcherForFeatureFunction(): void
-    {
-        $featureName = 'test.testFeature';
-        $GLOBALS['TYPO3_CONF_VARS']['SYS']['features'][$featureName] = true;
-        $this->assertTrue(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '")'])
-        );
-        $this->assertTrue(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == true'])
-        );
-        $this->assertTrue(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === true'])
-        );
-        $this->assertFalse(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == false'])
-        );
-        $this->assertFalse(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === false'])
-        );
-
-        $GLOBALS['TYPO3_CONF_VARS']['SYS']['features'][$featureName] = false;
-        $this->assertFalse(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '")'])
-        );
-        $this->assertFalse(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == true'])
-        );
-        $this->assertFalse(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === true'])
-        );
-        $this->assertTrue(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") == false'])
-        );
-        $this->assertTrue(
-            $this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['feature("' . $featureName . '") === false'])
-        );
-    }
-
-    /**
      * @return array
      */
     public function hostnameDataProvider(): array