Revert "[FOLLOWUP][TASK] Remove extended fluid core class CmsVariableProvider" 53/54153/2
authorOliver Hader <oliver.hader@typo3.org>
Sun, 17 Sep 2017 17:49:21 +0000 (19:49 +0200)
committerHelmut Hummel <typo3@helhum.io>
Sun, 17 Sep 2017 19:40:10 +0000 (21:40 +0200)
This reverts commit 7fd3c2b85c710384f1e5fd34342e1455accde263.

Class CmsVariableProvider still exists in TYPO3_8-7 branch.

Change-Id: I7539db92a551e9cb6446bf284f4be46dcf42f81f
Reviewed-on: https://review.typo3.org/54153
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
Tested-by: TYPO3com <no-reply@typo3.com>
typo3/sysext/fluid/Tests/Unit/Core/Variables/CmsVariableProviderTest.php [new file with mode: 0644]
typo3/sysext/fluid/Tests/Unit/View/StandaloneViewTest.php

diff --git a/typo3/sysext/fluid/Tests/Unit/Core/Variables/CmsVariableProviderTest.php b/typo3/sysext/fluid/Tests/Unit/Core/Variables/CmsVariableProviderTest.php
new file mode 100644 (file)
index 0000000..1e453cf
--- /dev/null
@@ -0,0 +1,49 @@
+<?php
+namespace TYPO3\CMS\Fluid\Tests\Unit\Core\Variables;
+
+/*
+ * 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\Variables\CmsVariableProvider;
+
+/**
+ * Test case
+ */
+class CmsVariableProviderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+{
+    /**
+     * @test
+     */
+    public function getByPathDelegatesToObjectAccess()
+    {
+        $instance = new CmsVariableProvider();
+        $instance->setSource(['foo' => 'bar']);
+        $this->assertEquals('bar', $instance->getByPath('foo'));
+    }
+
+    /**
+     * @test
+     */
+    public function dynamicAccessWorks()
+    {
+        $instance = new CmsVariableProvider();
+        $instance->setSource(
+            [
+                'foo' => [
+                    'hello' => 'world',
+                ],
+                'key' => 'hello'
+            ]
+        );
+        $this->assertEquals('world', $instance->getByPath('foo.{key}'));
+    }
+}
index bc02f00..771ed7a 100644 (file)
@@ -21,11 +21,11 @@ use TYPO3\CMS\Extbase\Mvc\Web\Request;
 use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
 use TYPO3\CMS\Fluid\Core\Parser\PreProcessor\XmlnsNamespaceTemplatePreProcessor;
 use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
+use TYPO3\CMS\Fluid\Core\Variables\CmsVariableProvider;
 use TYPO3\CMS\Fluid\View\StandaloneView;
 use TYPO3\CMS\Fluid\View\TemplatePaths;
 use TYPO3Fluid\Core\Compiler\TemplateCompiler;
 use TYPO3Fluid\Fluid\Core\Parser\TemplateParser;
-use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
 use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer;
 
 /**
@@ -89,7 +89,7 @@ class StandaloneViewTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
     protected $mockTemplatePaths;
 
     /**
-     * @var StandardVariableProvider|\PHPUnit_Framework_MockObject_MockObject
+     * @var CmsVariableProvider|\PHPUnit_Framework_MockObject_MockObject
      */
     protected $mockVariableProvider;