[TASK] Remove redundant Fluid overrides 03/51803/3
authorClaus Due <claus@namelesscoder.net>
Thu, 23 Feb 2017 14:14:37 +0000 (15:14 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 27 Feb 2017 18:47:08 +0000 (19:47 +0100)
Since Fluid 2.3.0 is now the minimum required version,
we can drop several of the classes/methods TYPO3
uses to change/extend Fluid's behavior. The features
provided by the classes are now provided by Fluid.

Change-Id: I781ef4e6aeedc7aabb4cd3bac0ec8a7416de1ab9
Resolves: #79972
Releases: master
Reviewed-on: https://review.typo3.org/51803
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christer V <cvi@systime.dk>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Documentation/Changelog/master/Deprecation-79972-DeprecatedFluidOverrides.rst [new file with mode: 0644]
typo3/sysext/fluid/Classes/Core/Parser/PreProcessor/XmlnsNamespaceTemplatePreProcessor.php [deleted file]
typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/Expression/LegacyNamespaceExpressionNode.php [deleted file]
typo3/sysext/fluid/Classes/Core/Rendering/RenderingContext.php
typo3/sysext/fluid/Classes/View/TemplatePaths.php
typo3/sysext/fluid/Tests/Unit/Core/Parser/PreProcessor/XmlnsNamespaceTemplatePreProcessorTest.php [deleted file]
typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/LegacyNamespaceExpressionNodeTest.php [deleted file]

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-79972-DeprecatedFluidOverrides.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-79972-DeprecatedFluidOverrides.rst
new file mode 100644 (file)
index 0000000..1094a9b
--- /dev/null
@@ -0,0 +1,36 @@
+.. include:: ../../Includes.txt
+
+================================================
+Deprecation: #79972 - Deprecated Fluid Overrides
+================================================
+
+See :issue:`79972`
+
+Description
+===========
+
+* ``XmlnsNamespaceTemplatePreProcessor`` is removed without substitute (no longer required)
+* ``LegacyNamespaceExpressionNode`` is removed without substitute (no longer required)
+* ``setLegacyMode`` and `$legacyMode` on RenderingContext is deprecated (no-op, triggers deprecation log message)
+* ``$objectManager`` plus injection method on RenderingContext is deprecated (no usages)
+* ``getObjectManager`` on RenderingContext is removed (no usages)
+
+Impact
+======
+
+Calling any of the methods above will trigger a deprecation log entry.
+
+
+Affected Installations
+======================
+
+Any TYPO3 instances which uses the above described methods or classes.
+
+
+Migration
+=========
+
+* Remove usage of classes / properties / methods.
+
+
+.. index:: Fluid
diff --git a/typo3/sysext/fluid/Classes/Core/Parser/PreProcessor/XmlnsNamespaceTemplatePreProcessor.php b/typo3/sysext/fluid/Classes/Core/Parser/PreProcessor/XmlnsNamespaceTemplatePreProcessor.php
deleted file mode 100644 (file)
index f228f9b..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Core\Parser\PreProcessor;
-
-/*
- * 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 TYPO3Fluid\Fluid\Core\Parser\TemplateProcessorInterface;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-
-/**
- * Class XmlnsNamespaceTemplatePreProcessor
- */
-class XmlnsNamespaceTemplatePreProcessor implements TemplateProcessorInterface
-{
-    /**
-     * @var RenderingContextInterface
-     */
-    protected $renderingContext;
-
-    /**
-     * @param RenderingContextInterface $renderingContext
-     * @return void
-     */
-    public function setRenderingContext(RenderingContextInterface $renderingContext)
-    {
-        $this->renderingContext = $renderingContext;
-    }
-
-    /**
-     * Pre-process the template source before it is returned to the TemplateParser or passed to
-     * the next TemplateProcessorInterface instance.
-     *
-     * Detects all tags that carry an `xmlns:` definition using a Fluid-compatible prefix and a
-     * conventional namespace URL (http://typo3.org/ns/). Extracts the detected namespaces and
-     * removes the detected tag.
-     *
-     * @param string $templateSource
-     * @return string
-     */
-    public function preProcessSource($templateSource)
-    {
-        $matches = [];
-        $namespacePattern = 'xmlns:([a-z0-9]+)="(http\\:\\/\\/typo3\\.org\\/ns\\/[^"]+)"';
-        $matched = preg_match('/<([a-z0-9]+)(?:[^>]*?)\\s+' . $namespacePattern . '[^>]*>/', $templateSource, $matches);
-        if ($matched) {
-            $namespaces = [];
-            preg_match_all('/' . $namespacePattern . '/', $matches[0], $namespaces, PREG_SET_ORDER);
-            foreach ($namespaces as $set) {
-                $namespaceUrl = $set[2];
-                $namespaceUri = substr($namespaceUrl, 20);
-                $namespacePhp = str_replace('/', '\\', $namespaceUri);
-                $this->renderingContext->getViewHelperResolver()->addNamespace($set[1], $namespacePhp);
-            }
-            if (strpos($matches[0], 'data-namespace-typo3-fluid="true"')) {
-                $templateSource = str_replace($matches[0], '', $templateSource);
-                $closingTagName = $matches[1];
-                $closingTag = '</' . $closingTagName . '>';
-                if (strpos($templateSource, $closingTag)) {
-                    $templateSource = substr($templateSource, 0, strrpos($templateSource, $closingTag)) .
-                        substr($templateSource, strrpos($templateSource, $closingTag) + strlen($closingTag));
-                }
-            } else {
-                if (!empty($namespaces)) {
-                    $namespaceAttributesToRemove = [];
-                    foreach ($namespaces as $namespace) {
-                        $namespaceAttributesToRemove[] = preg_quote($namespace[1], '/') . '="' . preg_quote($namespace[2], '/') . '"';
-                    }
-                    $matchWithRemovedNamespaceAttributes = preg_replace('/(?:\\s*+xmlns:(?:' . implode('|', $namespaceAttributesToRemove) . ')\\s*+)++/', ' ', $matches[0]);
-                    $templateSource = str_replace($matches[0], $matchWithRemovedNamespaceAttributes, $templateSource);
-                }
-            }
-        }
-        return $templateSource;
-    }
-}
diff --git a/typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/Expression/LegacyNamespaceExpressionNode.php b/typo3/sysext/fluid/Classes/Core/Parser/SyntaxTree/Expression/LegacyNamespaceExpressionNode.php
deleted file mode 100644 (file)
index 67894a8..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\Expression;
-
-/*
- * 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 TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\AbstractExpressionNode;
-use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\ExpressionNodeInterface;
-use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
-
-/**
- * Class LegacyNamespaceExpressionNode
- */
-class LegacyNamespaceExpressionNode extends AbstractExpressionNode implements ExpressionNodeInterface
-{
-    /**
-     * Pattern which detects ternary conditions written in shorthand
-     * syntax, e.g. {checkvar ? thenvar : elsevar}.
-     */
-    public static $detectionExpression = '/{namespace\\s*([a-z0-9]+)\\s*=\\s*([a-z0-9_\\\\]+)\\s*}/i';
-
-    /**
-     * @param RenderingContextInterface $renderingContext
-     * @param string $expression
-     * @param array $matches
-     * @return mixed
-     */
-    public static function evaluateExpression(RenderingContextInterface $renderingContext, $expression, array $matches)
-    {
-        $renderingContext->getViewHelperResolver()->addNamespace($matches[1], $matches[2]);
-    }
-}
index ca68d43..e390f81 100644 (file)
@@ -19,17 +19,15 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Fluid\Core\Cache\FluidTemplateCache;
 use TYPO3\CMS\Fluid\Core\Parser\InterceptorInterface;
-use TYPO3\CMS\Fluid\Core\Parser\PreProcessor\XmlnsNamespaceTemplatePreProcessor;
-use TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\Expression\LegacyNamespaceExpressionNode;
 use TYPO3\CMS\Fluid\Core\Variables\CmsVariableProvider;
 use TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperResolver;
 use TYPO3\CMS\Fluid\View\TemplatePaths;
 use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler;
 use TYPO3Fluid\Fluid\Core\Parser\Configuration;
-use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\CastingExpressionNode;
-use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\MathExpressionNode;
-use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\Expression\TernaryExpressionNode;
 use TYPO3Fluid\Fluid\Core\Parser\TemplateParser;
+use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\EscapingModifierTemplateProcessor;
+use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\NamespaceDetectionTemplateProcessor;
+use TYPO3Fluid\Fluid\Core\Parser\TemplateProcessor\PassthroughSourceModifierTemplateProcessor;
 use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInvoker;
 use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer;
 use TYPO3Fluid\Fluid\View\ViewInterface;
@@ -51,6 +49,7 @@ class RenderingContext extends \TYPO3Fluid\Fluid\Core\Rendering\RenderingContext
      * the whole syntax tree should be cacheable
      *
      * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9
      */
     protected $objectManager;
 
@@ -62,45 +61,16 @@ class RenderingContext extends \TYPO3Fluid\Fluid\Core\Rendering\RenderingContext
     protected $controllerContext;
 
     /**
-     * ViewHelper Variable Container
-     *
-     * @var \TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer
-     */
-    protected $viewHelperVariableContainer;
-
-    /**
      * Use legacy behavior? Can be overridden using setLegacyMode().
      *
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9
      * @var bool
      */
     protected $legacyMode = false;
 
     /**
-     * List of class names implementing ExpressionNodeInterface
-     * which will be consulted when an expression does not match
-     * any built-in parser expression types.
-     *
-     * @var string
-     */
-    protected $expressionNodeTypes = [
-        LegacyNamespaceExpressionNode::class,
-        CastingExpressionNode::class,
-        MathExpressionNode::class,
-        TernaryExpressionNode::class
-    ];
-
-    /**
-     * Alternative ExpressionNodeInterface implementers for use
-     * when put into legacy mode.
-     *
-     * @var string
-     */
-    protected $legacyExpressionNodeTypes = [
-        LegacyNamespaceExpressionNode::class
-    ];
-
-    /**
      * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9
      */
     public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
     {
@@ -132,20 +102,20 @@ class RenderingContext extends \TYPO3Fluid\Fluid\Core\Rendering\RenderingContext
             $this->setTemplateCompiler(new TemplateCompiler());
             $this->setViewHelperInvoker(new ViewHelperInvoker());
             $this->setViewHelperVariableContainer(new ViewHelperVariableContainer());
+            $this->setTemplateProcessors(
+                [
+                    new EscapingModifierTemplateProcessor(),
+                    new PassthroughSourceModifierTemplateProcessor(),
+                    new NamespaceDetectionTemplateProcessor()
+                ]
+            );
         }
 
         $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
         $this->setTemplatePaths($objectManager->get(TemplatePaths::class));
         $this->setViewHelperResolver($objectManager->get(ViewHelperResolver::class));
         $this->setVariableProvider($objectManager->get(CmsVariableProvider::class));
-        $this->setTemplateProcessors(
-            array_merge(
-                parent::getTemplateProcessors(),
-                [
-                    $objectManager->get(XmlnsNamespaceTemplatePreProcessor::class),
-                ]
-            )
-        );
+
         /** @var FluidTemplateCache $cache */
         $cache = $objectManager->get(CacheManager::class)->getCache('fluid_template');
         if (is_a($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['fluid_template']['frontend'], FluidTemplateCache::class, true)) {
@@ -180,25 +150,20 @@ class RenderingContext extends \TYPO3Fluid\Fluid\Core\Rendering\RenderingContext
      * If set to FALSE, the ViewHelperResolver will only load a limited sub-set of ExpressionNodes,
      * making Fluid behave like the legacy version of the CMS core extension.
      *
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9
      * @param bool $legacyMode
      * @return void
      */
     public function setLegacyMode($legacyMode)
     {
+        GeneralUtility::logDeprecatedFunction();
         $this->legacyMode = $legacyMode;
     }
 
     /**
-     * @return string
-     */
-    public function getExpressionNodeTypes()
-    {
-        return $this->legacyMode ? $this->legacyExpressionNodeTypes : $this->expressionNodeTypes;
-    }
-
-    /**
      * Returns the object manager. Only the ViewHelperNode should do this.
      *
+     * @deprecated since TYPO3 v8, will be removed in TYPO3 v9
      * @return \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
      */
     public function getObjectManager()
@@ -275,14 +240,4 @@ class RenderingContext extends \TYPO3Fluid\Fluid\Core\Rendering\RenderingContext
             $this->setControllerName($controllerName);
         }
     }
-
-    /**
-     * Get the ViewHelperVariableContainer
-     *
-     * @return \TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer
-     */
-    public function getViewHelperVariableContainer()
-    {
-        return $this->viewHelperVariableContainer;
-    }
 }
index 384e193..3e7dc6a 100644 (file)
@@ -139,23 +139,6 @@ class TemplatePaths extends \TYPO3Fluid\Fluid\View\TemplatePaths
     }
 
     /**
-     * @param string|array $path
-     * @return string
-     */
-    protected function sanitizePath($path)
-    {
-        if (is_array($path)) {
-            $paths = array_map([$this, 'sanitizePath'], $path);
-            return array_unique($paths);
-        }
-        $path = $this->ensureAbsolutePath($path);
-        if (is_dir($path)) {
-            $path = $this->ensureSuffixedPath($path);
-        }
-        return $path;
-    }
-
-    /**
      * Guarantees that $reference is turned into a
      * correct, absolute path. The input can be a
      * relative path or a FILE: or EXT: reference
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/Parser/PreProcessor/XmlnsNamespaceTemplatePreProcessorTest.php b/typo3/sysext/fluid/Tests/Unit/Core/Parser/PreProcessor/XmlnsNamespaceTemplatePreProcessorTest.php
deleted file mode 100644 (file)
index d35ea53..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\PreProcessor;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Fluid\Core\Parser\PreProcessor\XmlnsNamespaceTemplatePreProcessor;
-use TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperResolver;
-use TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture;
-
-/**
- * Class XmlnsNamespaceTemplatePreProcessorTest
- */
-class XmlnsNamespaceTemplatePreProcessorTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @param string $source
-     * @param array $expectedNamespaces
-     * @param string $expectedSource
-     * @test
-     * @dataProvider preProcessSourceExtractsNamespacesAndRemovesTagsAndAttributesDataProvider
-     */
-    public function preProcessSourceExtractsNamespacesAndRemovesTagsAndAttributes($source, array $expectedNamespaces, $expectedSource)
-    {
-        $subject = new XmlnsNamespaceTemplatePreProcessor();
-        $resolver = $this->getMockBuilder(ViewHelperResolver::class)
-            ->setMethods(['addNamespace'])
-            ->getMock();
-        $context = $this->getMockBuilder(RenderingContextFixture::class)
-            ->setMethods(['getViewHelperResolver'])
-            ->getMock();
-        if (empty($expectedNamespaces)) {
-            $context->expects($this->never())->method('getViewHelperResolver');
-            $resolver->expects($this->never())->method('addNamespace');
-        } else {
-            $context->expects($this->exactly(count($expectedNamespaces)))->method('getViewHelperResolver')->willReturn($resolver);
-            foreach ($expectedNamespaces as $index => $expectedNamespaceParts) {
-                list($prefix, $phpNamespace) = $expectedNamespaceParts;
-                $resolver->expects($this->at($index))->method('addNamespace')->with($prefix, $phpNamespace);
-            }
-        }
-        $subject->setRenderingContext($context);
-        $result = $subject->preProcessSource($source);
-        if ($expectedSource === null) {
-            $this->assertEquals($source, $result);
-        } else {
-            $this->assertEquals($expectedSource, $result);
-        }
-    }
-
-    /**
-     * DataProvider for preProcessSourceExtractsNamespacesAndRemovesTagsAndAttributes test
-     *
-     * @return array
-     */
-    public function preProcessSourceExtractsNamespacesAndRemovesTagsAndAttributesDataProvider()
-    {
-        return [
-            'Empty source raises no errors' => [
-                '',
-                [],
-                null,
-            ],
-            'Tags without xmlns remain untouched' => [
-                '<div class="not-touched">...</div>',
-                [],
-                null
-            ],
-            'Third-party namespace not detected' => [
-                '<html xmlns:notdetected="http://thirdparty.org/ns/Foo/Bar/ViewHelpers">...</html>',
-                [],
-                null
-            ],
-            'Detects and removes Fluid namespaces by namespace URL' => [
-                '<html xmlns:detected="http://typo3.org/ns/Foo/Bar/ViewHelpers" data-namespace-typo3-fluid="true">...</html>',
-                [
-                    ['detected', 'Foo\\Bar\\ViewHelpers']
-                ],
-                '...'
-            ],
-            'Skips fluid namespace if namespace URL is not the correct case' => [
-                '<html xmlns:detected="http://typo3.org/Ns/Foo/Bar/ViewHelpers" data-namespace-typo3-fluid="true">...</html>',
-                [],
-                null
-            ],
-            'Skips fluid namespace if attribute is not the correct case' => [
-                '<html xmlNS:detected="http://typo3.org/ns/Foo/Bar/ViewHelpers" data-namespace-typo3-fluid="true">...</html>',
-                [],
-                null
-            ],
-            'Skips namespace if attribute before xmlns attribute without space in between' => [
-                '<html lang="de"xmlns:detected="http://typo3.org/ns/Foo/Bar/ViewHelpers" data-namespace-typo3-fluid="true">...</html>',
-                [],
-                null
-            ],
-            'Removes tag if data attribute set and non xmlns attributes are used prior to xmlns' => [
-                '<html lang="de" xmlns:detected="http://typo3.org/ns/Foo/Bar/ViewHelpers" data-namespace-typo3-fluid="true">...</html>',
-                [
-                    ['detected', 'Foo\\Bar\\ViewHelpers']
-                ],
-                '...'
-            ],
-            'Skips invalid namespace prefixes' => [
-                '<html xmlns:bad-prefix="http://typo3.org/ns/Foo/Bar/ViewHelpers">...</html>',
-                [],
-                null
-            ],
-            'Detect and remove multiple ViewHelper attributes' => [
-                '<div xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers">' . "\n"
-                        . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>',
-                [
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers'],
-                    ['fe', 'TYPO3\\CMS\\Frontend\\ViewHelpers']
-                ],
-                '<div >' . "\n"
-                    . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>'
-            ],
-            'ViewHelpers found with non ViewHelper xmlns at beginning' => [
-                '<div xmlns:z="http://www.typo3.org/foo"' . "\n"
-                    . "\t" . 'xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers">' . "\n"
-                        . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>',
-                [
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers'],
-                    ['fe', 'TYPO3\\CMS\\Frontend\\ViewHelpers']
-                ],
-                '<div xmlns:z="http://www.typo3.org/foo" >' . "\n"
-                    . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>'
-            ],
-            'ViewHelpers found with non ViewHelper xmlns at end' => [
-                '<div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:z="http://www.typo3.org/foo">' . "\n"
-                        . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>',
-                [
-                    ['fe', 'TYPO3\\CMS\\Frontend\\ViewHelpers'],
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers']
-                ],
-                '<div xmlns:z="http://www.typo3.org/foo">' . "\n"
-                    . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>',
-            ],
-            'Xmlns ViewHelpers found with multiple non ViewHelper xmlns attributes' => [
-                '<div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:y="http://www.typo3.org/bar"' . "\n"
-                    . "\t" . 'xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:z="http://www.typo3.org/foo">' . "\n"
-                        . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>',
-                [
-                    ['fe', 'TYPO3\\CMS\\Frontend\\ViewHelpers'],
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers']
-                ],
-                '<div xmlns:y="http://www.typo3.org/bar" xmlns:z="http://www.typo3.org/foo">' . "\n"
-                    . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>'
-            ],
-            'Xmlns ViewHelpers found with non ViewHelpers between' => [
-                '<div xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"' . "\n"
-                . "\t" . 'xmlns:z="http://www.typo3.org/foo"' . "\n"
-                . "\t" . 'xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">' . "\n"
-                    . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>',
-                [
-                    ['fe', 'TYPO3\\CMS\\Frontend\\ViewHelpers'],
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers']
-                ],
-                '<div xmlns:z="http://www.typo3.org/foo" >' . "\n"
-                    . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</div>'
-            ],
-            'Do not remove Html tag with data attribute but no xmlns ViewHelpers found' => [
-                '<html data-namespace-typo3-fluid="true">' . "\n"
-                    . "\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</html>',
-                [],
-                null
-            ],
-            'Keep html tag if data attribute is not set and remove ViewHelper attributes' => [
-                '<html xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:z="http://www.typo3.org/foo">' . "\n"
-                        . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</html>',
-                [
-                    ['fe', 'TYPO3\\CMS\\Frontend\\ViewHelpers'],
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers']
-                ],
-                '<html xmlns:z="http://www.typo3.org/foo">' . "\n"
-                    . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</html>',
-            ],
-            'Remove html tag because xmlns ViewHelpers found and data attribute set' => [
-                '<html data-namespace-typo3-fluid="true"' . "\n"
-                    . "\t" . 'xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"' . "\n"
-                    . "\t" . 'xmlns:z="http://www.typo3.org/foo">' . "\n"
-                        . "\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                . '</html>',
-                [
-                    ['fe', 'TYPO3\\CMS\\Frontend\\ViewHelpers']
-                ],
-                "\n\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-            ],
-            'Test with big markup template' => [
-                file_get_contents(GeneralUtility::getFileAbsFileName('EXT:fluid/Tests/Unit/Core/Fixtures/TestNamespaceTemplateBig.html')),
-                [
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers'],
-                    ['core', 'TYPO3\\CMS\\Core\\ViewHelpers'],
-                    ['fl', 'TYPO3\\CMS\\Filelist\\ViewHelpers']
-                ],
-                file_get_contents(GeneralUtility::getFileAbsFileName('EXT:fluid/Tests/Unit/Core/Fixtures/TestNamespaceTemplateBigExpectedResult.html'))
-            ],
-            'Only handle first tag with xmlns ViewHelpers found' => [
-                '<div xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers">' . "\n"
-                    . "\t" . '<div data-namespace-typo3-fluid="true" xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"' . "\n"
-                        . "\t\t" . 'xmlns:z="http://www.typo3.org/foo">' . "\n"
-                            . "\t\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                    . "\t" . '</div>' . "\n"
-                . '</div>',
-                [
-                    ['f', 'TYPO3\\CMS\\Fluid\\ViewHelpers']
-                ],
-                '<div >' . "\n"
-                    . "\t" . '<div data-namespace-typo3-fluid="true" xmlns:fe="http://typo3.org/ns/TYPO3/CMS/Frontend/ViewHelpers"' . "\n"
-                        . "\t\t" . 'xmlns:z="http://www.typo3.org/foo">' . "\n"
-                            . "\t\t\t" . '<f:if condition="{demo}">Hello World</f:if>' . "\n"
-                    . "\t" . '</div>' . "\n"
-                . '</div>'
-            ]
-        ];
-    }
-}
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/LegacyNamespaceExpressionNodeTest.php b/typo3/sysext/fluid/Tests/Unit/Core/Parser/SyntaxTree/LegacyNamespaceExpressionNodeTest.php
deleted file mode 100644 (file)
index b1c5fa3..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Parser\SyntaxTree;
-
-/*
- * 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\Fluid\Core\Parser\SyntaxTree\Expression\LegacyNamespaceExpressionNode;
-use TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture;
-
-/**
- * Class LegacyNamespaceExpressionNodeTest
- */
-class LegacyNamespaceExpressionNodeTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @test
-     * @dataProvider getEvaluateExpressionTestValues
-     * @param array $matches
-     * @param array $expected
-     */
-    public function evaluateExpressionExtractsNamespaces(array $matches, array $expected)
-    {
-        $resolver = $this->getMockBuilder('TYPO3Fluid\\Fluid\\Core\\ViewHelper\\ViewHelperResolver')
-            ->setMethods(['addNamespace'])
-            ->getMock();
-        $resolver->expects($this->once())->method('addNamespace')->with($expected[0], $expected[1]);
-        $context = $this->getMockBuilder(RenderingContextFixture::class)
-            ->setMethods(['getViewHelperResolver'])
-            ->getMock();
-        $context->expects($this->once())->method('getViewHelperResolver')->willReturn($resolver);
-        LegacyNamespaceExpressionNode::evaluateExpression($context, $matches[0], $matches);
-    }
-
-    /**
-     * @return array
-     */
-    public function getEvaluateExpressionTestValues()
-    {
-        return [
-            [
-                ['foo', 'bar', 'baz'],
-                ['bar', 'baz']
-            ],
-            [
-                ['test1', 'test2', 'test3'],
-                ['test2', 'test3']
-            ]
-        ];
-    }
-}