[BUGFIX] Make ViewHelperBaseTestcase always available 60/49160/4
authorMark Watney <mark.watney@protonmail.com>
Thu, 21 Jul 2016 22:50:54 +0000 (00:50 +0200)
committerHelmut Hummel <typo3@helhum.io>
Fri, 22 Jul 2016 07:08:48 +0000 (09:08 +0200)
This is a follow-up commit to f648cdc.

To ease the usage of the core with extensions, with f648cdc we moved the
base test classes into a different place to be able to make them available
when typo3/cms is pulled in as dependency, e.g. for testing extensions or
in projects.

The current .gitattributes file causes that this class was not available
when typo3/cms is pulled in as dependency, e.g. for testing extensions or
in projects.

This is a non breaking change, as the classes will be available in any
case after that.

Resolves: #77205
Releases: master, 7.6
Change-Id: I6f00ac1cb8c48cf2faea8bae666af691d8a1f7c2
Reviewed-on: https://review.typo3.org/49160
Reviewed-by: Helmut Hummel <typo3@helhum.io>
Tested-by: Helmut Hummel <typo3@helhum.io>
typo3/sysext/fluid/Classes/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php [new file with mode: 0644]
typo3/sysext/fluid/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php [deleted file]

diff --git a/typo3/sysext/fluid/Classes/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php b/typo3/sysext/fluid/Classes/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php
new file mode 100644 (file)
index 0000000..dff158f
--- /dev/null
@@ -0,0 +1,110 @@
+<?php
+namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
+
+/*                                                                        *
+ * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
+ *                                                                        *
+ * It is free software; you can redistribute it and/or modify it under    *
+ * the terms of the GNU General Public License, either version 3 of the   *
+ * License, or (at your option) any later version.                        *
+ *                                                                        *
+ * The TYPO3 project - inspiring people to share!                         *
+ *                                                                        */
+
+/**
+ * Base test class for testing view helpers
+ */
+abstract class ViewHelperBaseTestcase extends \TYPO3\CMS\Core\Tests\UnitTestCase
+{
+    /**
+     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer
+     */
+    protected $viewHelperVariableContainer;
+
+    /**
+     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer
+     */
+    protected $templateVariableContainer;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
+     */
+    protected $uriBuilder;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext
+     */
+    protected $controllerContext;
+
+    /**
+     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder
+     */
+    protected $tagBuilder;
+
+    /**
+     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\Arguments
+     */
+    protected $arguments;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Web\Request
+     */
+    protected $request;
+
+    /**
+     * @var \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext
+     */
+    protected $renderingContext;
+
+    /**
+     * @var \TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService
+     */
+    protected $mvcPropertyMapperConfigurationService;
+
+    /**
+     * @return void
+     */
+    protected function setUp()
+    {
+        $this->viewHelperVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class);
+        $this->templateVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer::class);
+        $this->uriBuilder = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
+        $this->uriBuilder->expects($this->any())->method('reset')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setArguments')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setSection')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setFormat')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setCreateAbsoluteUri')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setAddQueryString')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setArgumentsToBeExcludedFromQueryString')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setLinkAccessRestrictedPages')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setTargetPageUid')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setTargetPageType')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setNoCache')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setUseCacheHash')->will($this->returnValue($this->uriBuilder));
+        $this->uriBuilder->expects($this->any())->method('setAddQueryStringMethod')->will($this->returnValue($this->uriBuilder));
+        $this->request = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Web\Request::class);
+        $this->controllerContext = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class, array(), array(), '', false);
+        $this->controllerContext->expects($this->any())->method('getUriBuilder')->will($this->returnValue($this->uriBuilder));
+        $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
+        $this->tagBuilder = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::class);
+        $this->arguments = array();
+        $this->renderingContext = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContext::class, array('dummy'));
+        $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
+        $this->renderingContext->_set('viewHelperVariableContainer', $this->viewHelperVariableContainer);
+        $this->renderingContext->setControllerContext($this->controllerContext);
+        $this->mvcPropertyMapperConfigurationService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService::class, array('dummy'));
+    }
+
+    /**
+     * @param \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper
+     * @return void
+     */
+    protected function injectDependenciesIntoViewHelper(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper)
+    {
+        $viewHelper->setRenderingContext($this->renderingContext);
+        $viewHelper->setArguments($this->arguments);
+        if ($viewHelper instanceof \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper) {
+            $viewHelper->_set('tag', $this->tagBuilder);
+        }
+    }
+}
diff --git a/typo3/sysext/fluid/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php b/typo3/sysext/fluid/Tests/Unit/ViewHelpers/ViewHelperBaseTestcase.php
deleted file mode 100644 (file)
index dff158f..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers;
-
-/*                                                                        *
- * This script is backported from the TYPO3 Flow package "TYPO3.Fluid".   *
- *                                                                        *
- * It is free software; you can redistribute it and/or modify it under    *
- * the terms of the GNU General Public License, either version 3 of the   *
- * License, or (at your option) any later version.                        *
- *                                                                        *
- * The TYPO3 project - inspiring people to share!                         *
- *                                                                        */
-
-/**
- * Base test class for testing view helpers
- */
-abstract class ViewHelperBaseTestcase extends \TYPO3\CMS\Core\Tests\UnitTestCase
-{
-    /**
-     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer
-     */
-    protected $viewHelperVariableContainer;
-
-    /**
-     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer
-     */
-    protected $templateVariableContainer;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder
-     */
-    protected $uriBuilder;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext
-     */
-    protected $controllerContext;
-
-    /**
-     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder
-     */
-    protected $tagBuilder;
-
-    /**
-     * @var \TYPO3\CMS\Fluid\Core\ViewHelper\Arguments
-     */
-    protected $arguments;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Web\Request
-     */
-    protected $request;
-
-    /**
-     * @var \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext
-     */
-    protected $renderingContext;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService
-     */
-    protected $mvcPropertyMapperConfigurationService;
-
-    /**
-     * @return void
-     */
-    protected function setUp()
-    {
-        $this->viewHelperVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class);
-        $this->templateVariableContainer = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\TemplateVariableContainer::class);
-        $this->uriBuilder = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder::class);
-        $this->uriBuilder->expects($this->any())->method('reset')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setArguments')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setSection')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setFormat')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setCreateAbsoluteUri')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setAddQueryString')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setArgumentsToBeExcludedFromQueryString')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setLinkAccessRestrictedPages')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setTargetPageUid')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setTargetPageType')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setNoCache')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setUseCacheHash')->will($this->returnValue($this->uriBuilder));
-        $this->uriBuilder->expects($this->any())->method('setAddQueryStringMethod')->will($this->returnValue($this->uriBuilder));
-        $this->request = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Web\Request::class);
-        $this->controllerContext = $this->getMock(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class, array(), array(), '', false);
-        $this->controllerContext->expects($this->any())->method('getUriBuilder')->will($this->returnValue($this->uriBuilder));
-        $this->controllerContext->expects($this->any())->method('getRequest')->will($this->returnValue($this->request));
-        $this->tagBuilder = $this->getMock(\TYPO3\CMS\Fluid\Core\ViewHelper\TagBuilder::class);
-        $this->arguments = array();
-        $this->renderingContext = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\Rendering\RenderingContext::class, array('dummy'));
-        $this->renderingContext->injectTemplateVariableContainer($this->templateVariableContainer);
-        $this->renderingContext->_set('viewHelperVariableContainer', $this->viewHelperVariableContainer);
-        $this->renderingContext->setControllerContext($this->controllerContext);
-        $this->mvcPropertyMapperConfigurationService = $this->getAccessibleMock(\TYPO3\CMS\Extbase\Mvc\Controller\MvcPropertyMappingConfigurationService::class, array('dummy'));
-    }
-
-    /**
-     * @param \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper
-     * @return void
-     */
-    protected function injectDependenciesIntoViewHelper(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper $viewHelper)
-    {
-        $viewHelper->setRenderingContext($this->renderingContext);
-        $viewHelper->setArguments($this->arguments);
-        if ($viewHelper instanceof \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper) {
-            $viewHelper->_set('tag', $this->tagBuilder);
-        }
-    }
-}