[!!!][TASK] Remove CMS base ViewHelper classes 68/54068/11
authorClaus Due <claus@namelesscoder.net>
Sat, 9 Sep 2017 15:13:13 +0000 (17:13 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Tue, 5 Dec 2017 19:36:09 +0000 (20:36 +0100)
This patch sacrifices two features:

* Having $this->controllerContext on ViewHelpers
* Support for render method arguments

And by doing so, allows the removal of every CMS
base ViewHelper class and several overrides they
implement. The base classes are still available as
class aliases to limit the breaking change to the two
features mentioned above.

Change-Id: I425b01234618f83d701ec6dd99ce3bf7ce514589
Resolves: #82414
Releases: master
Reviewed-on: https://review.typo3.org/54068
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
31 files changed:
typo3/sysext/core/Documentation/Changelog/master/Breaking-82414-RemoveCMSBaseViewHelperClasses.rst [new file with mode: 0644]
typo3/sysext/extensionmanager/Classes/ViewHelpers/ConfigureExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Link/ActionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ReloadSqlDataViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/RemoveExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ShowExtensionVersionsViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ToggleExtensionInstallationStateViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/UpdateScriptViewHelper.php
typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractConditionViewHelper.php [deleted file]
typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractTagBasedViewHelper.php [deleted file]
typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php [deleted file]
typo3/sysext/fluid/Classes/Core/ViewHelper/ArgumentDefinition.php [deleted file]
typo3/sysext/fluid/Classes/ViewHelpers/Be/ContainerViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/MediaViewHelper.php
typo3/sysext/fluid/Classes/ViewHelpers/Widget/LinkViewHelper.php
typo3/sysext/fluid/Migrations/Code/ClassAliasMap.php
typo3/sysext/fluid/Migrations/Code/LegacyClassesForIde.php
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php [deleted file]
typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/ArgumentDefinitionTest.php [deleted file]
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/HiddenViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/PasswordViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SelectViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/SubmitViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/TextareaViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Form/UploadViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/EmailViewHelperTest.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/ExternalViewHelperTest.php
typo3/sysext/fluid/Tests/UnitDeprecated/Core/ViewHelper/AbstractViewHelperTest.php [deleted file]
typo3/sysext/form/Classes/ViewHelpers/FormViewHelper.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82414-RemoveCMSBaseViewHelperClasses.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82414-RemoveCMSBaseViewHelperClasses.rst
new file mode 100644 (file)
index 0000000..69041b7
--- /dev/null
@@ -0,0 +1,52 @@
+.. include:: ../../Includes.txt
+
+======================================================
+Breaking: #82414 - CMS ViewHelper base classes removed
+======================================================
+
+See :issue:`82414`
+
+Description
+===========
+
+The following ViewHelper base classes have been removed:
+
+- :php:`TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper`
+- :php:`TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper`
+- :php:`TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper`
+- :php:`TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition`
+
+Aliases are in place, but the following key differences may break your code:
+
+- Render method arguments are no longer possible at all
+- The property :php:`$this->controllerContext` is no longer defined
+
+
+Impact
+======
+
+Render method arguments have been deprecated for a long time and should already have been migrated
+in your code. If you still have ViewHelpers using render method arguments, these will break
+after this change.
+
+
+Affected Installations
+======================
+
+All instances which use a ViewHelper that either contains render method arguments, extends from one
+of the base classes above, or or accesses :php:`$this->controllerContext`.
+
+
+Migration
+=========
+
+Migrate to use `renderStatic` methods (see examples in TYPO3 Core, EXT:fluid) to not use
+render method arguments.
+
+
+ViewHelpers which access :php:`$this->controllerContext` can instead access
+:php:`$this->renderingContext->getControllerContext()`.
+
+Migrating this can be done with search-and-replace for all common use cases.
+
+.. index:: Fluid, NotScanned
\ No newline at end of file
index b58dbf9..71ac2be 100644 (file)
@@ -49,7 +49,7 @@ class ConfigureExtensionViewHelper extends Link\ActionViewHelper
 
         $content = (string)$this->renderChildren();
         if ($extension['installed'] && file_exists(PATH_site . $extension['siteRelPath'] . 'ext_conf_template.txt')) {
-            $uriBuilder = $this->controllerContext->getUriBuilder();
+            $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
             $action = 'showConfigurationForm';
             $uri = $uriBuilder->reset()->uriFor(
                 $action,
index fa9c6ba..5c8a92b 100644 (file)
@@ -90,7 +90,7 @@ class DownloadExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\Abst
                        </li>';
         }
         $pathSelector .= '</ul>';
-        $uriBuilder = $this->controllerContext->getUriBuilder();
+        $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
         $action = 'checkDependencies';
         $uriBuilder->reset();
         $uriBuilder->setFormat('json');
@@ -138,7 +138,7 @@ class DownloadExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Form\Abst
      */
     protected function getDefaultFieldNamePrefix()
     {
-        $request = $this->controllerContext->getRequest();
+        $request = $this->renderingContext->getControllerContext()->getRequest();
         if ($this->hasArgument('extensionName')) {
             $extensionName = $this->arguments['extensionName'];
         } else {
index 41976f5..d22ea77 100644 (file)
@@ -27,6 +27,19 @@ class ActionViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBased
     protected $tagName = 'a';
 
     /**
+     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
+     */
+    protected $objectManager;
+
+    /**
+     * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
+     */
+    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
+    {
+        $this->objectManager = $objectManager;
+    }
+
+    /**
      * Arguments initialization
      */
     public function initializeArguments()
index 966d289..c22e8ee 100644 (file)
@@ -70,7 +70,7 @@ class ReloadSqlDataViewHelper extends Link\ActionViewHelper
             $languageKey = 'extensionList.databaseImport';
         }
 
-        $uriBuilder = $this->controllerContext->getUriBuilder();
+        $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
         $uriBuilder->reset();
         $uri = $uriBuilder->uriFor('reloadExtensionData', ['extension' => $extension['key']], 'Action');
         $this->tag->addAttribute('href', $uri);
index a969aa0..fda413b 100644 (file)
@@ -53,7 +53,7 @@ class RemoveExtensionViewHelper extends Link\ActionViewHelper
         ) {
             return '<span class="btn btn-default disabled">' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . '</span>';
         }
-        $uriBuilder = $this->controllerContext->getUriBuilder();
+        $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
         $action = 'removeExtension';
         $uriBuilder->reset();
         $uriBuilder->setFormat('json');
index 7706319..4d137a9 100644 (file)
@@ -46,7 +46,7 @@ class ShowExtensionVersionsViewHelper extends Link\ActionViewHelper
         /** @var Extension $extension */
         $extension = $this->arguments['extension'];
 
-        $uriBuilder = $this->controllerContext->getUriBuilder();
+        $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
         $action = 'showAllVersions';
         $uri = $uriBuilder->reset()->uriFor($action, [
             'extensionKey' => $extension->getExtensionKey(),
index e872481..4fedb54 100644 (file)
@@ -56,7 +56,7 @@ class ToggleExtensionInstallationStateViewHelper extends Link\ActionViewHelper
             return '';
         }
 
-        $uriBuilder = $this->controllerContext->getUriBuilder();
+        $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
         $action = 'toggleExtensionInstallationState';
         $uri = $uriBuilder->reset()->uriFor($action, [
             'extensionKey' => $extension['key']
index 41ba7e5..1edb205 100644 (file)
@@ -25,19 +25,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
 class UpdateScriptViewHelper extends Link\ActionViewHelper
 {
     /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-     */
-    protected $objectManager;
-
-    /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
      * initialize arguments
      */
     public function initializeArguments()
@@ -62,7 +49,7 @@ class UpdateScriptViewHelper extends Link\ActionViewHelper
         /** @var IconFactory $iconFactory */
         $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
         if ($updateScriptUtility->checkUpdateScriptExists($extensionKey)) {
-            $uriBuilder = $this->controllerContext->getUriBuilder();
+            $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
             $action = 'show';
             $uri = $uriBuilder->reset()->uriFor(
                 $action,
diff --git a/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractConditionViewHelper.php b/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractConditionViewHelper.php
deleted file mode 100644 (file)
index 353e8e6..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Core\ViewHelper;
-
-/*
- * 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!
- */
-
-/**
- * Class AbstractConditionViewHelper
- */
-abstract class AbstractConditionViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper
-{
-    /**
-     * Controller Context to use
-     *
-     * @var \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext
-     * @api
-     */
-    protected $controllerContext;
-
-    /**
-     * Renders <f:then> child if $condition is true, otherwise renders <f:else> child.
-     *
-     * @param bool $condition View helper condition
-     * @return string the rendered string
-     * @api
-     */
-    public function render()
-    {
-        if (static::evaluateCondition($this->arguments)) {
-            return $this->renderThenChild();
-        }
-        return $this->renderElseChild();
-    }
-
-    /**
-     * @param \TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext
-     */
-    public function setRenderingContext(\TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
-    {
-        parent::setRenderingContext($renderingContext);
-        if ($renderingContext instanceof \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext) {
-            $this->controllerContext = $renderingContext->getControllerContext();
-        }
-    }
-}
diff --git a/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractTagBasedViewHelper.php b/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractTagBasedViewHelper.php
deleted file mode 100644 (file)
index fcc976d..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Core\ViewHelper;
-
-/*
- * 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!
- */
-
-/**
- * Tag based view helper.
- * Sould be used as the base class for all view helpers which output simple tags, as it provides some
- * convenience methods to register default attributes, ...
- *
- * @api
- */
-abstract class AbstractTagBasedViewHelper extends AbstractViewHelper
-{
-    /**
-     * Names of all registered tag attributes
-     *
-     * @var array
-     */
-    private static $tagAttributes = [];
-
-    /**
-     * name of the tag to be created by this view helper
-     *
-     * @var string
-     * @api
-     */
-    protected $tagName = 'div';
-
-    /**
-     * @var \TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder
-     */
-    protected $tag;
-
-    /**
-     * @var bool
-     */
-    protected $escapeOutput = false;
-
-    /**
-     * Constructor
-     */
-    public function __construct()
-    {
-        $this->tag = new \TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder();
-    }
-
-    /**
-     * Constructor
-     *
-     * @api
-     */
-    public function initializeArguments()
-    {
-        $this->registerArgument('additionalAttributes', 'array', 'Additional tag attributes. They will be added directly to the resulting HTML tag.', false);
-        $this->registerArgument('data', 'array', 'Additional data-* attributes. They will each be added with a "data-" prefix.', false);
-        parent::initializeArguments();
-    }
-
-    /**
-     * Sets the tag name to $this->tagName.
-     * Additionally, sets all tag attributes which were registered in
-     * $this->tagAttributes and additionalArguments.
-     *
-     * Will be invoked just before the render method.
-     *
-     * @api
-     */
-    public function initialize()
-    {
-        parent::initialize();
-        $this->tag->reset();
-        $this->tag->setTagName($this->tagName);
-        if ($this->hasArgument('additionalAttributes') && is_array($this->arguments['additionalAttributes'])) {
-            $this->tag->addAttributes($this->arguments['additionalAttributes']);
-        }
-
-        if ($this->hasArgument('data') && is_array($this->arguments['data'])) {
-            foreach ($this->arguments['data'] as $dataAttributeKey => $dataAttributeValue) {
-                $this->tag->addAttribute('data-' . $dataAttributeKey, $dataAttributeValue);
-            }
-        }
-
-        if (isset(self::$tagAttributes[static::class])) {
-            foreach (self::$tagAttributes[static::class] as $attributeName) {
-                if ($this->hasArgument($attributeName) && $this->arguments[$attributeName] !== '') {
-                    $this->tag->addAttribute($attributeName, $this->arguments[$attributeName]);
-                }
-            }
-        }
-    }
-
-    /**
-     * Register a new tag attribute. Tag attributes are all arguments which will be directly appended to a tag if you call $this->initializeTag()
-     *
-     * @param string $name Name of tag attribute
-     * @param string $type Type of the tag attribute
-     * @param string $description Description of tag attribute
-     * @param bool $required set to TRUE if tag attribute is required. Defaults to FALSE.
-     * @param string $default Default value
-     * @api
-     */
-    protected function registerTagAttribute($name, $type, $description, $required = false, $default = null)
-    {
-        $this->registerArgument($name, $type, $description, $required, $default);
-        self::$tagAttributes[static::class][$name] = $name;
-    }
-
-    /**
-     * Registers all standard HTML universal attributes.
-     * Should be used inside registerArguments();
-     *
-     * @api
-     */
-    protected function registerUniversalTagAttributes()
-    {
-        $this->registerTagAttribute('class', 'string', 'CSS class(es) for this element');
-        $this->registerTagAttribute('dir', 'string', 'Text direction for this HTML element. Allowed strings: "ltr" (left to right), "rtl" (right to left)');
-        $this->registerTagAttribute('id', 'string', 'Unique (in this file) identifier for this HTML element.');
-        $this->registerTagAttribute('lang', 'string', 'Language for this element. Use short names specified in RFC 1766');
-        $this->registerTagAttribute('style', 'string', 'Individual CSS styles for this element');
-        $this->registerTagAttribute('title', 'string', 'Tooltip text of element');
-        $this->registerTagAttribute('accesskey', 'string', 'Keyboard shortcut to access this element');
-        $this->registerTagAttribute('tabindex', 'integer', 'Specifies the tab order of this element');
-        $this->registerTagAttribute('onclick', 'string', 'JavaScript evaluated for the onclick event');
-    }
-}
diff --git a/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php b/typo3/sysext/fluid/Classes/Core/ViewHelper/AbstractViewHelper.php
deleted file mode 100644 (file)
index 17a28f3..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Core\ViewHelper;
-
-/*
- * 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 Psr\Log\LoggerInterface;
-use TYPO3\CMS\Core\Log\LogManager;
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-use TYPO3\CMS\Extbase\Reflection\ReflectionService;
-
-/**
- * The abstract base class for all view helpers.
- *
- * @api
- */
-abstract class AbstractViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper implements \TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperInterface
-{
-    /**
-     * Controller Context to use
-     *
-     * @var \TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext
-     * @api
-     */
-    protected $controllerContext;
-
-    /**
-     * @var \TYPO3\CMS\Extbase\Object\ObjectManagerInterface
-     */
-    protected $objectManager;
-
-    /**
-     * @param \TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext
-     */
-    public function setRenderingContext(\TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
-    {
-        parent::setRenderingContext($renderingContext);
-        if ($renderingContext instanceof \TYPO3\CMS\Fluid\Core\Rendering\RenderingContext) {
-            $this->controllerContext = $renderingContext->getControllerContext();
-        }
-    }
-
-    /**
-     * @param \TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager
-     */
-    public function injectObjectManager(\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
-    {
-        $this->objectManager = $objectManager;
-    }
-
-    /**
-     * Call the render() method and handle errors.
-     *
-     * @return string the rendered ViewHelper
-     * @throws Exception
-     */
-    protected function callRenderMethod()
-    {
-        $renderMethodParameters = [];
-        if ($this->hasRenderMethodArguments()) {
-            foreach ($this->argumentDefinitions as $argumentName => $argumentDefinition) {
-                if ($argumentDefinition instanceof \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition && $argumentDefinition->isMethodParameter()) {
-                    $renderMethodParameters[$argumentName] = $this->arguments[$argumentName];
-                }
-            }
-        }
-
-        try {
-            return call_user_func_array([$this, 'render'], $renderMethodParameters);
-        } catch (Exception $exception) {
-            if (GeneralUtility::getApplicationContext()->isProduction()) {
-                $this->getLogger()->error('A Fluid ViewHelper Exception was captured: ' . $exception->getMessage() . ' (' . $exception->getCode() . ')', ['exception' => $exception]);
-                return '';
-            }
-            throw $exception;
-        }
-    }
-
-    /**
-     * @return LoggerInterface
-     */
-    protected function getLogger()
-    {
-        return GeneralUtility::makeInstance(LogManager::class)->getLogger(__CLASS__);
-    }
-
-    /**
-     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10; intentionally not deprecation logged (logged once above)
-     * @return bool
-     */
-    protected function hasRenderMethodArguments()
-    {
-        return (new \ReflectionMethod($this, 'render'))->getNumberOfParameters() > 0;
-    }
-
-    /**
-     * Register method arguments for "render" by analysing the doc comment above.
-     *
-     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10; logged from this location but not elsewhere in class.
-     * @throws \TYPO3Fluid\Fluid\Core\Parser\Exception
-     */
-    protected function registerRenderMethodArguments()
-    {
-        trigger_error(sprintf('Render method argument support is deprecated (used on class "%s"), switch to initializeArguments and registerArgument.', static::class), E_USER_DEPRECATED);
-
-        $reflectionService = $this->getReflectionService();
-        $methodParameters = $reflectionService->getMethodParameters(static::class, 'render');
-        $methodTags = $reflectionService->getMethodTagsValues(static::class, 'render');
-
-        $paramAnnotations = [];
-        if (isset($methodTags['param'])) {
-            $paramAnnotations = $methodTags['param'];
-        }
-
-        $i = 0;
-        foreach ($methodParameters as $parameterName => $parameterInfo) {
-            $dataType = null;
-            if (isset($parameterInfo['type'])) {
-                $dataType = isset($parameterInfo['array']) && (bool)$parameterInfo['array'] ? 'array' : $parameterInfo['type'];
-            } else {
-                throw new \TYPO3\CMS\Fluid\Core\Exception('Could not determine type of argument "' . $parameterName . '" of the render-method in ViewHelper "' . static::class . '". Either the methods docComment is invalid or some PHP optimizer strips off comments.', 1242292003);
-            }
-
-            $description = '';
-            if (isset($paramAnnotations[$i])) {
-                $explodedAnnotation = explode(' ', $paramAnnotations[$i]);
-                array_shift($explodedAnnotation);
-                array_shift($explodedAnnotation);
-                $description = implode(' ', $explodedAnnotation);
-            }
-            $defaultValue = null;
-            if (isset($parameterInfo['defaultValue'])) {
-                $defaultValue = $parameterInfo['defaultValue'];
-            }
-            $this->argumentDefinitions[$parameterName] = new ArgumentDefinition($parameterName, $dataType, $description, ($parameterInfo['optional'] === false), $defaultValue, true);
-            $i++;
-        }
-    }
-
-    /**
-     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10; intentionally not deprecation logged (logged once above)
-     * @return ReflectionService
-     */
-    protected function getReflectionService()
-    {
-        return $this->objectManager->get(ReflectionService::class);
-    }
-
-    /**
-     * @return \TYPO3Fluid\Fluid\Core\ViewHelper\ArgumentDefinition[]
-     * @throws \TYPO3Fluid\Fluid\Core\Parser\Exception
-     */
-    public function prepareArguments()
-    {
-        if ($this->hasRenderMethodArguments() && method_exists($this, 'registerRenderMethodArguments')) {
-            $this->registerRenderMethodArguments();
-        }
-        return parent::prepareArguments();
-    }
-}
diff --git a/typo3/sysext/fluid/Classes/Core/ViewHelper/ArgumentDefinition.php b/typo3/sysext/fluid/Classes/Core/ViewHelper/ArgumentDefinition.php
deleted file mode 100644 (file)
index cc2b505..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Core\ViewHelper;
-
-/*
- * 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!
- */
-
-/**
- * Argument definition of each view helper argument
- *
- * This subclass of ArgumentDefinition from Fluid has
- * one additional capability: defining that an argument
- * should be expected as a parameter for the render()
- * method - which means the ViewHelperInvoker will be
- * processing it a bit differently. Other than this it
- * is a normal Fluid ArgumentDefinition.
- */
-class ArgumentDefinition extends \TYPO3Fluid\Fluid\Core\ViewHelper\ArgumentDefinition
-{
-    /**
-     * TRUE if it is a method parameter
-     *
-     * @var bool
-     */
-    protected $isMethodParameter = false;
-
-    /**
-     * Constructor for this argument definition.
-     *
-     * @param string $name Name of argument
-     * @param string $type Type of argument
-     * @param string $description Description of argument
-     * @param bool $required TRUE if argument is required
-     * @param mixed $defaultValue Default value
-     * @param bool $isMethodParameter TRUE if this argument is a method parameter
-     */
-    public function __construct($name, $type, $description, $required, $defaultValue = null, $isMethodParameter = false)
-    {
-        $this->name = $name;
-        $this->type = $type;
-        $this->description = $description;
-        $this->required = $required;
-        $this->defaultValue = $defaultValue;
-        $this->isMethodParameter = $isMethodParameter;
-    }
-
-    /**
-     * TRUE if it is a method parameter
-     *
-     * @return bool TRUE if it's a method parameter
-     */
-    public function isMethodParameter()
-    {
-        return $this->isMethodParameter;
-    }
-}
index c074f08..a9cc8ed 100644 (file)
@@ -99,7 +99,7 @@ class ContainerViewHelper extends AbstractBackendViewHelper
         }
         // Add inline language labels
         if (is_array($addJsInlineLabels) && count($addJsInlineLabels) > 0) {
-            $extensionKey = $this->controllerContext->getRequest()->getControllerExtensionKey();
+            $extensionKey = $this->renderingContext->getControllerContext()->getRequest()->getControllerExtensionKey();
             foreach ($addJsInlineLabels as $key) {
                 $label = LocalizationUtility::translate($key, $extensionKey);
                 $pageRenderer->addInlineLanguageLabel($key, $label);
index 715c495..327e004 100644 (file)
@@ -76,10 +76,10 @@ class ActionMenuItemViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abstract
         $action = $this->arguments['action'];
         $arguments = $this->arguments['arguments'];
 
-        $uriBuilder = $this->controllerContext->getUriBuilder();
+        $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
         $uri = $uriBuilder->reset()->uriFor($action, $arguments, $controller);
         $this->tag->addAttribute('value', $uri);
-        $currentRequest = $this->controllerContext->getRequest();
+        $currentRequest = $this->renderingContext->getControllerContext()->getRequest();
         $currentController = $currentRequest->getControllerName();
         $currentAction = $currentRequest->getControllerActionName();
         if ($action === $currentAction && $controller === $currentController) {
index c979e5b..84f138c 100644 (file)
@@ -18,6 +18,7 @@ use TYPO3\CMS\Core\Imaging\ImageManipulation\CropVariantCollection;
 use TYPO3\CMS\Core\Resource\FileInterface;
 use TYPO3\CMS\Core\Resource\FileReference;
 use TYPO3\CMS\Core\Resource\Rendering\RendererRegistry;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Extbase\Domain\Model\AbstractFileFolder;
 use TYPO3\CMS\Extbase\Service\ImageService;
 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
@@ -160,6 +161,6 @@ class MediaViewHelper extends AbstractTagBasedViewHelper
      */
     protected function getImageService()
     {
-        return $this->objectManager->get(ImageService::class);
+        return GeneralUtility::makeInstance(ImageService::class);
     }
 }
index 8bb3848..d384163 100644 (file)
@@ -87,12 +87,12 @@ class LinkViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedVi
         $action = $this->arguments['action'];
         $arguments = $this->arguments['arguments'];
         if ($action === null) {
-            $action = $this->controllerContext->getRequest()->getControllerActionName();
+            $action = $this->renderingContext->getControllerContext()->getRequest()->getControllerActionName();
         }
         $arguments['id'] = $GLOBALS['TSFE']->id;
         // @todo page type should be configurable
         $arguments['type'] = 7076;
-        $arguments['fluid-widget-id'] = $this->controllerContext->getRequest()->getWidgetContext()->getAjaxWidgetIdentifier();
+        $arguments['fluid-widget-id'] = $this->renderingContext->getControllerContext()->getRequest()->getWidgetContext()->getAjaxWidgetIdentifier();
         $arguments['action'] = $action;
         return '?' . http_build_query($arguments, null, '&');
     }
@@ -104,8 +104,8 @@ class LinkViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedVi
      */
     protected function getWidgetUri()
     {
-        $uriBuilder = $this->controllerContext->getUriBuilder();
-        $argumentPrefix = $this->controllerContext->getRequest()->getArgumentPrefix();
+        $uriBuilder = $this->renderingContext->getControllerContext()->getUriBuilder();
+        $argumentPrefix = $this->renderingContext->getControllerContext()->getRequest()->getArgumentPrefix();
         $arguments = $this->hasArgument('arguments') ? $this->arguments['arguments'] : [];
         if ($this->hasArgument('action')) {
             $arguments['action'] = $this->arguments['action'];
index c089882..92fb7c8 100644 (file)
@@ -1,5 +1,11 @@
 <?php
 return [
+    // Base classes removed in TYPO3v9
+    'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractViewHelper' => \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper::class,
+    'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractConditionViewHelper' => \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper::class,
+    'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\AbstractTagBasedViewHelper' => \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper::class,
+
+    // Compiler/parser related aliases
     'TYPO3\\CMS\\Fluid\\Core\\Compiler\\TemplateCompiler' => \TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler::class,
     'TYPO3\\CMS\\Fluid\\Core\\Parser\\InterceptorInterface' => \TYPO3Fluid\Fluid\Core\Parser\InterceptorInterface::class,
     'TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\NodeInterface' => \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\NodeInterface::class,
@@ -21,6 +27,7 @@ return [
     // Fluid variable containers, ViewHelpers, interfaces
     'TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\RootNode' => \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\RootNode::class,
     'TYPO3\\CMS\\Fluid\\Core\\Parser\\SyntaxTree\\ViewHelperNode' => \TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode::class,
+    'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\ArgumentDefinition' => \TYPO3Fluid\Fluid\Core\ViewHelper\ArgumentDefinition::class,
     'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\TemplateVariableContainer' => \TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider::class,
     'TYPO3\\CMS\\Fluid\\Core\\ViewHelper\\ViewHelperVariableContainer' => \TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer::class,
     'TYPO3\\CMS\\Fluid\\Core\\Variables\\CmsVariableProvider' => \TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider::class,
index 13005c4..e0a97a5 100644 (file)
@@ -96,6 +96,15 @@ namespace TYPO3\CMS\Fluid\Core\Parser\SyntaxTree {
 }
 
 namespace TYPO3\CMS\Fluid\Core\ViewHelper {
+    abstract class AbstractViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper
+    {
+    }
+    abstract class AbstractConditionViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper
+    {
+    }
+    abstract class AbstractTagBasedViewHelper extends \TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper
+    {
+    }
     class TemplateVariableContainer extends \TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider
     {
     }
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php b/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/AbstractViewHelperTest.php
deleted file mode 100644 (file)
index 86cd76a..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
-
-/*
- * 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\Extbase\Mvc\Request;
-use TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture;
-use TYPO3Fluid\Fluid\Core\Variables\StandardVariableProvider;
-use TYPO3Fluid\Fluid\Core\ViewHelper\ViewHelperVariableContainer;
-
-/**
- * Test case
- */
-class AbstractViewHelperTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @var array
-     */
-    protected $fixtureMethodParameters = [
-        'param1' => [
-            'position' => 0,
-            'optional' => false,
-            'type' => 'integer',
-            'defaultValue' => null
-        ],
-        'param2' => [
-            'position' => 1,
-            'optional' => false,
-            'type' => 'array',
-            'array' => true,
-            'defaultValue' => null
-        ],
-        'param3' => [
-            'position' => 2,
-            'optional' => true,
-            'type' => 'string',
-            'array' => false,
-            'defaultValue' => 'default'
-        ],
-    ];
-
-    /**
-     * @var array
-     */
-    protected $fixtureMethodTags = [
-        'param' => [
-            'integer $param1 P1 Stuff',
-            'array $param2 P2 Stuff',
-            'string $param3 P3 Stuff'
-        ]
-    ];
-
-    protected function setUp()
-    {
-        $this->mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
-    }
-
-    /**
-     * @test
-     */
-    public function prepareArgumentsCallsInitializeArguments()
-    {
-        $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper::class, ['render', 'initializeArguments'], [], '', false);
-
-        $viewHelper->expects($this->once())->method('initializeArguments');
-
-        $viewHelper->prepareArguments();
-    }
-
-    /**
-     * @test
-     */
-    public function validateArgumentsCallsPrepareArguments()
-    {
-        $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper::class, ['render', 'prepareArguments'], [], '', false);
-
-        $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue([]));
-
-        $viewHelper->validateArguments();
-    }
-
-    /**
-     * @test
-     */
-    public function validateArgumentsAcceptsAllObjectsImplemtingArrayAccessAsAnArray()
-    {
-        $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper::class, ['render', 'prepareArguments'], [], '', false);
-
-        $viewHelper->setArguments(['test' => new \ArrayObject]);
-        $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue(['test' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('test', 'array', false, 'documentation')]));
-        $viewHelper->validateArguments();
-    }
-
-    /**
-     * @test
-     */
-    public function validateArgumentsCallsTheRightValidators()
-    {
-        $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper::class, ['render', 'prepareArguments'], [], '', false);
-
-        $viewHelper->setArguments(['test' => 'Value of argument']);
-
-        $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue([
-            'test' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('test', 'string', false, 'documentation')
-        ]));
-
-        $viewHelper->validateArguments();
-    }
-
-    /**
-     * @test
-     */
-    public function validateArgumentsCallsTheRightValidatorsAndThrowsExceptionIfValidationIsWrong()
-    {
-        $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper::class, ['render', 'prepareArguments'], [], '', false);
-
-        $this->expectException(\InvalidArgumentException::class);
-        $this->expectExceptionCode(1256475113);
-
-        $viewHelper->setArguments(['test' => 'test']);
-
-        $viewHelper->expects($this->once())->method('prepareArguments')->will($this->returnValue([
-            'test' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('test', 'stdClass', false, 'documentation')
-        ]));
-
-        $viewHelper->validateArguments();
-    }
-
-    /**
-     * @test
-     */
-    public function initializeArgumentsAndRenderCallsTheCorrectSequenceOfMethods()
-    {
-        $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper::class, ['validateArguments', 'initialize', 'callRenderMethod']);
-        $viewHelper->expects($this->at(0))->method('validateArguments');
-        $viewHelper->expects($this->at(1))->method('initialize');
-        $viewHelper->expects($this->at(2))->method('callRenderMethod')->will($this->returnValue('Output'));
-
-        $expectedOutput = 'Output';
-        $actualOutput = $viewHelper->initializeArgumentsAndRender(['argument1' => 'value1']);
-        $this->assertEquals($expectedOutput, $actualOutput);
-    }
-
-    /**
-     * @test
-     */
-    public function setRenderingContextShouldSetInnerVariables()
-    {
-        $templateVariableContainer = $this->createMock(StandardVariableProvider::class);
-        $viewHelperVariableContainer = $this->createMock(ViewHelperVariableContainer::class);
-        $controllerContext = $this->getMockBuilder(\TYPO3\CMS\Extbase\Mvc\Controller\ControllerContext::class)
-            ->setMethods(['getRequest'])
-            ->disableOriginalConstructor()
-            ->getMock();
-        $controllerContext->expects($this->atLeastOnce())->method('getRequest')->willReturn($this->createMock(Request::class));
-
-        $renderingContext = $this->getAccessibleMock(RenderingContextFixture::class, ['getControllerContext']);
-        $renderingContext->expects($this->any())->method('getControllerContext')->willReturn($controllerContext);
-        $renderingContext->setVariableProvider($templateVariableContainer);
-        $renderingContext->_set('viewHelperVariableContainer', $viewHelperVariableContainer);
-        $renderingContext->setControllerContext($controllerContext);
-
-        $viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper::class, ['render', 'prepareArguments'], [], '', false);
-
-        $viewHelper->setRenderingContext($renderingContext);
-
-        $this->assertSame($viewHelper->_get('templateVariableContainer'), $templateVariableContainer);
-        $this->assertSame($viewHelper->_get('viewHelperVariableContainer'), $viewHelperVariableContainer);
-        $this->assertSame($viewHelper->_get('controllerContext'), $controllerContext);
-    }
-}
diff --git a/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/ArgumentDefinitionTest.php b/typo3/sysext/fluid/Tests/Unit/Core/ViewHelper/ArgumentDefinitionTest.php
deleted file mode 100644 (file)
index 4983744..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Tests\Unit\Core\ViewHelper;
-
-/*
- * 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!
- */
-
-/**
- * Test case
- */
-class ArgumentDefinitionTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @test
-     */
-    public function objectStoresDataCorrectly()
-    {
-        $name = 'This is a name';
-        $description = 'Example desc';
-        $type = 'string';
-        $isRequired = true;
-        $isMethodParameter = true;
-        $argumentDefinition = new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition($name, $type, $description, $isRequired, null, $isMethodParameter);
-
-        $this->assertEquals($argumentDefinition->getName(), $name, 'Name could not be retrieved correctly.');
-        $this->assertEquals($argumentDefinition->getDescription(), $description, 'Description could not be retrieved correctly.');
-        $this->assertEquals($argumentDefinition->getType(), $type, 'Type could not be retrieved correctly');
-        $this->assertEquals($argumentDefinition->isRequired(), $isRequired, 'Required flag could not be retrieved correctly.');
-        $this->assertEquals($argumentDefinition->isMethodParameter(), $isMethodParameter, 'isMethodParameter flag could not be retrieved correctly.');
-    }
-}
index 176eee8..2ff5d22 100644 (file)
@@ -31,7 +31,6 @@ class HiddenViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         parent::setUp();
         $this->viewHelper = $this->getAccessibleMock(HiddenViewHelper::class, ['setErrorClassAttribute', 'getName', 'getValueAttribute', 'registerFieldNameForFormTokenGeneration']);
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->initializeArguments();
     }
 
     /**
@@ -50,9 +49,8 @@ class HiddenViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
 
         $this->viewHelper->expects($this->once())->method('getName')->will($this->returnValue('foo'));
         $this->viewHelper->expects($this->once())->method('getValueAttribute')->will($this->returnValue('bar'));
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 }
index a507904..8ded544 100644 (file)
@@ -21,7 +21,7 @@ use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
 class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\FormFieldViewHelperBaseTestcase
 {
     /**
-     * @var \TYPO3\CMS\Fluid\ViewHelpers\Form\TextboxViewHelper
+     * @var \TYPO3\CMS\Fluid\ViewHelpers\Form\PasswordViewHelper
      */
     protected $viewHelper;
 
@@ -31,7 +31,6 @@ class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Form\PasswordViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration']);
         $this->arguments['name'] = '';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->initializeArguments();
     }
 
     /**
@@ -44,10 +43,8 @@ class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
             ->disableOriginalConstructor()
             ->getMock();
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
-
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -64,7 +61,7 @@ class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('NameOfTextbox');
         $mockTagBuilder->expects($this->at(2))->method('addAttribute')->with('value', 'Current value');
         $mockTagBuilder->expects($this->once())->method('render');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
         $arguments = [
             'name' => 'NameOfTextbox',
@@ -73,8 +70,7 @@ class PasswordViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper->setArguments($arguments);
 
         $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
index baa714b..c71c576 100644 (file)
@@ -34,7 +34,7 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['sortByOptionLabel'] = false;
         $this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Form\SelectViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration', 'renderChildren']);
         $this->tagBuilder = $this->createMock(\TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder::class);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
     }
 
     /**
@@ -46,9 +46,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
 
         $this->arguments['options'] = [];
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -69,9 +68,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['name'] = 'myName';
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -93,12 +91,11 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         ];
         $this->arguments['value'] = 'value2';
         $this->arguments['name'] = 'myName';
-        $this->arguments['required'] = '1';
+        $this->arguments['required'] = true;
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -134,9 +131,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         ];
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -171,9 +167,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['options'] = [$obj1, $obj2, $obj3, $obj4];
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -209,9 +204,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         ]);
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -234,9 +228,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['name'] = 'myName';
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -260,9 +253,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['sortByOptionLabel'] = true;
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -298,9 +290,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['name'] = 'myName';
         $this->arguments['sortByOptionLabel'] = true;
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -321,10 +312,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['multiple'] = true;
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initializeArguments();
-        $this->viewHelper->initialize();
-        $result = $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $result = $this->viewHelper->initializeArgumentsAndRender();
         $expected = '<input type="hidden" name="myName" value="" /><select multiple="multiple" name="myName[]"><option value="value1" selected="selected">label1</option>' . chr(10) . '<option value="value2">label2</option>' . chr(10) . '<option value="value3" selected="selected">label3</option>' . chr(10) . '</select>';
         $this->assertSame($expected, $result);
     }
@@ -358,9 +347,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['optionLabelField'] = 'firstName';
         $this->arguments['name'] = 'myName';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -386,10 +374,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['multiple'] = true;
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initializeArguments();
-        $this->viewHelper->initialize();
-        $actual = $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $actual = $this->viewHelper->initializeArgumentsAndRender();
         $expected = '<input type="hidden" name="myName" value="" /><select multiple="multiple" name="myName[]"><option value="1" selected="selected">Schlecht</option>' . chr(10) .
             '<option value="2">Kurfuerst</option>' . chr(10) .
             '<option value="3" selected="selected">Lemke</option>' . chr(10) .
@@ -426,10 +412,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['multiple'] = true;
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initializeArguments();
-        $this->viewHelper->initialize();
-        $actual = $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $actual = $this->viewHelper->initializeArgumentsAndRender();
         $expected = '<input type="hidden" name="myName" value="" />' .
             '<select multiple="multiple" name="myName[]">' .
             '<option value="1" selected="selected">Schlecht</option>' . chr(10) .
@@ -460,9 +444,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         ];
         $this->arguments['name'] = 'myName';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -490,9 +473,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         ];
         $this->arguments['name'] = 'myName';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -514,9 +496,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         ];
         $this->arguments['name'] = 'myName';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -527,9 +508,9 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['options'] = [];
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
         $this->viewHelper->expects($this->once())->method('setErrorClassAttribute');
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -549,9 +530,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['selectAllByDefault'] = true;
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -572,9 +552,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['selectAllByDefault'] = true;
 
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -594,9 +573,8 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['name'] = 'myName';
         $this->arguments['prependOptionLabel'] = 'please choose';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -617,8 +595,7 @@ class SelectViewHelperTest extends ViewHelperBaseTestcase
         $this->arguments['prependOptionLabel'] = 'please choose';
         $this->arguments['prependOptionValue'] = '-1';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 }
index 62e54de..fd38b2e 100644 (file)
@@ -31,7 +31,6 @@ class SubmitViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         $this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Form\SubmitViewHelper::class, ['dummy']);
         $this->arguments['name'] = '';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->initializeArguments();
     }
 
     /**
@@ -45,9 +44,8 @@ class SubmitViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('input');
         $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('type', 'submit');
 
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 }
index 5bf54e7..e769ac7 100644 (file)
@@ -31,7 +31,6 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Form\TextareaViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration']);
         $this->arguments['name'] = '';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->initializeArguments();
     }
 
     /**
@@ -44,10 +43,9 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
             ->disableOriginalConstructor()
             ->getMock();
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('textarea');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -72,8 +70,7 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper->setArguments($arguments);
 
         $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -98,7 +95,7 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper->expects($this->once())->method('registerFieldNameForFormTokenGeneration')->with('NameOfTextarea');
         $mockTagBuilder->expects($this->once())->method('setContent')->with('some &lt;tag&gt; &amp; &quot;quotes&quot;');
         $mockTagBuilder->expects($this->once())->method('render');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
         $arguments = [
             'name' => 'NameOfTextarea',
@@ -107,8 +104,7 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper->setArguments($arguments);
 
         $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -123,7 +119,7 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $mockTagBuilder->expects($this->at(0))->method('addAttribute')->with('placeholder', 'SomePlaceholder');
         $mockTagBuilder->expects($this->at(1))->method('addAttribute')->with('name', 'NameOfTextarea');
         $mockTagBuilder->expects($this->once())->method('render');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
         $arguments = [
             'name' => 'NameOfTextarea',
@@ -132,7 +128,6 @@ class TextareaViewHelperTest extends \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\For
         $this->viewHelper->setArguments($arguments);
 
         $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 }
index af3c425..481e05f 100644 (file)
@@ -33,7 +33,6 @@ class UploadViewHelperTest extends ViewHelperBaseTestcase
         $this->viewHelper = $this->getAccessibleMock(\TYPO3\CMS\Fluid\ViewHelpers\Form\UploadViewHelper::class, ['setErrorClassAttribute', 'registerFieldNameForFormTokenGeneration']);
         $this->arguments['name'] = '';
         $this->injectDependenciesIntoViewHelper($this->viewHelper);
-        $this->viewHelper->initializeArguments();
     }
 
     /**
@@ -43,9 +42,8 @@ class UploadViewHelperTest extends ViewHelperBaseTestcase
     {
         $this->tagBuilder = $this->createMock(\TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder::class);
         $this->tagBuilder->expects($this->once())->method('setTagName')->with('input');
-        $this->viewHelper->_set('tag', $this->tagBuilder);
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->setTagBuilder($this->tagBuilder);
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -65,14 +63,13 @@ class UploadViewHelperTest extends ViewHelperBaseTestcase
         $this->viewHelper->expects($this->at(3))->method('registerFieldNameForFormTokenGeneration')->with('someName[error]');
         $this->viewHelper->expects($this->at(4))->method('registerFieldNameForFormTokenGeneration')->with('someName[size]');
         $mockTagBuilder->expects($this->once())->method('render');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
         $arguments = [
             'name' => 'someName'
         ];
         $this->viewHelper->setArguments($arguments);
         $this->viewHelper->setViewHelperNode(new \TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Form\Fixtures\EmptySyntaxTreeNode());
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -81,7 +78,7 @@ class UploadViewHelperTest extends ViewHelperBaseTestcase
     public function renderCallsSetErrorClassAttribute()
     {
         $this->viewHelper->expects($this->once())->method('setErrorClassAttribute');
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -92,14 +89,13 @@ class UploadViewHelperTest extends ViewHelperBaseTestcase
         /** @var TagBuilder $tagBuilder */
         $tagBuilder = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(TagBuilder::class);
         $tagBuilder->addAttribute('multiple', 'multiple');
-        $this->viewHelper->_set('tag', $tagBuilder);
+        $this->viewHelper->setTagBuilder($tagBuilder);
         $arguments = [
             'name' => 'someName',
             'multiple' => 'multiple'
         ];
         $this->viewHelper->setArguments($arguments);
-        $this->viewHelper->initialize();
-        $result = $this->viewHelper->render();
+        $result = $this->viewHelper->initializeArgumentsAndRender();
         $this->assertEquals('<input multiple="multiple" type="file" name="someName[]" />', $result);
     }
 }
index 2c40a33..c84a9a4 100644 (file)
@@ -57,7 +57,7 @@ class EmailViewHelperTest extends ViewHelperBaseTestcase
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('a');
         $mockTagBuilder->expects($this->once())->method('addAttribute')->with('href', 'mailto:some@email.tld');
         $mockTagBuilder->expects($this->once())->method('setContent')->with('some content');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
         $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue('some content'));
         $this->setArgumentsUnderTest(
             $this->viewHelper,
@@ -65,8 +65,7 @@ class EmailViewHelperTest extends ViewHelperBaseTestcase
                 'email' => 'some@email.tld',
             ]
         );
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -78,7 +77,7 @@ class EmailViewHelperTest extends ViewHelperBaseTestcase
             ->setMethods(['setTagName', 'addAttribute', 'setContent'])
             ->getMock();
         $mockTagBuilder->expects($this->once())->method('setContent')->with('some@email.tld');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
         $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue(null));
         $this->setArgumentsUnderTest(
             $this->viewHelper,
@@ -86,8 +85,7 @@ class EmailViewHelperTest extends ViewHelperBaseTestcase
                 'email' => 'some@email.tld',
             ]
         );
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
index 96bab15..37130ea 100644 (file)
@@ -45,7 +45,7 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('a');
         $mockTagBuilder->expects($this->once())->method('addAttribute')->with('href', 'http://www.some-domain.tld');
         $mockTagBuilder->expects($this->once())->method('setContent')->with('some content');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
         $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue('some content'));
 
@@ -55,8 +55,7 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
                 'uri' => 'http://www.some-domain.tld',
             ]
         );
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -70,7 +69,7 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('a');
         $mockTagBuilder->expects($this->once())->method('addAttribute')->with('href', 'http://www.some-domain.tld');
         $mockTagBuilder->expects($this->once())->method('setContent')->with('some content');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
         $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue('some content'));
 
@@ -80,8 +79,7 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
                 'uri' => 'www.some-domain.tld',
             ]
         );
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -95,7 +93,7 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('a');
         $mockTagBuilder->expects($this->once())->method('addAttribute')->with('href', 'ftp://some-domain.tld');
         $mockTagBuilder->expects($this->once())->method('setContent')->with('some content');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
         $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue('some content'));
 
@@ -106,8 +104,7 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
                 'defaultScheme' => 'ftp',
             ]
         );
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 
     /**
@@ -121,7 +118,7 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
         $mockTagBuilder->expects($this->once())->method('setTagName')->with('a');
         $mockTagBuilder->expects($this->once())->method('addAttribute')->with('href', 'some-domain.tld');
         $mockTagBuilder->expects($this->once())->method('setContent')->with('some content');
-        $this->viewHelper->_set('tag', $mockTagBuilder);
+        $this->viewHelper->setTagBuilder($mockTagBuilder);
 
         $this->viewHelper->expects($this->any())->method('renderChildren')->will($this->returnValue('some content'));
 
@@ -132,7 +129,6 @@ class ExternalViewHelperTest extends ViewHelperBaseTestcase
                 'defaultScheme' => '',
             ]
         );
-        $this->viewHelper->initialize();
-        $this->viewHelper->render();
+        $this->viewHelper->initializeArgumentsAndRender();
     }
 }
diff --git a/typo3/sysext/fluid/Tests/UnitDeprecated/Core/ViewHelper/AbstractViewHelperTest.php b/typo3/sysext/fluid/Tests/UnitDeprecated/Core/ViewHelper/AbstractViewHelperTest.php
deleted file mode 100644 (file)
index 5fcfb81..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-<?php
-namespace TYPO3\CMS\Fluid\Tests\UnitDeprecated\Core\ViewHelper;
-
-/*
- * 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\Extbase\Reflection\ReflectionService;
-use TYPO3\CMS\Fluid\Core\Exception;
-use TYPO3\CMS\Fluid\Tests\Unit\Core\Fixtures\TestViewHelper;
-
-/**
- * Test case for deprecated functionality to still behave as before
- */
-class AbstractViewHelperTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
-{
-    /**
-     * @var array
-     */
-    protected $fixtureMethodParameters = [
-        'param1' => [
-            'position' => 0,
-            'optional' => false,
-            'type' => 'integer',
-            'defaultValue' => null
-        ],
-        'param2' => [
-            'position' => 1,
-            'optional' => false,
-            'type' => 'array',
-            'array' => true,
-            'defaultValue' => null
-        ],
-        'param3' => [
-            'position' => 2,
-            'optional' => true,
-            'type' => 'string',
-            'array' => false,
-            'defaultValue' => 'default'
-        ],
-    ];
-
-    /**
-     * @var array
-     */
-    protected $fixtureMethodTags = [
-        'param' => [
-            'integer $param1 P1 Stuff',
-            'array $param2 P2 Stuff',
-            'string $param3 P3 Stuff'
-        ]
-    ];
-
-    protected function setUp()
-    {
-        $this->mockReflectionService = $this->createMock(\TYPO3\CMS\Extbase\Reflection\ReflectionService::class);
-    }
-
-    /**
-     * @test
-     * @dataProvider getCallRenderMethodTestValues
-     * @param array $arguments
-     * @param bool $expectsException
-     */
-    public function registerRenderMethodArgumentsThrowsExceptionOnMissingType(array $arguments, $expectsException = false)
-    {
-        $reflectionService = $this->getMockBuilder(ReflectionService::class)
-            ->setMethods(['getMethodParameters', 'getMethodTagsValues'])
-            ->getMock();
-        $reflectionService->expects($this->once())->method('getMethodParameters')->willReturn(
-            [
-                'param1' => [
-                    'position' => 0,
-                    'byReference' => false,
-                    'optional' => false,
-                    'allowsNull' => true
-                ]
-            ]
-        );
-        $reflectionService->expects($this->once())->method('getMethodTagsValues')->willReturn([]);
-        $fixture = $this->getAccessibleMock(TestViewHelper::class, ['render', 'getReflectionService']);
-        $fixture->expects($this->once())->method('getReflectionService')->willReturn($reflectionService);
-        $this->expectException(Exception::class);
-        $this->callInaccessibleMethod($fixture, 'registerRenderMethodArguments');
-    }
-
-    /**
-     * @test
-     * @dataProvider getCallRenderMethodTestValues
-     * @param array $arguments
-     * @param bool $expectsException
-     */
-    public function callRenderMethodBehavesAsExpected(array $arguments, $expectsException = false)
-    {
-        $reflectionService = $this->getMockBuilder(ReflectionService::class)
-            ->setMethods(['getMethodParameters', 'getMethodTagsValues'])
-            ->getMock();
-        $reflectionService->expects($this->once())->method('getMethodParameters')->willReturn(
-            [
-                'param1' => [
-                    'position' => 0,
-                    'type' => 'integer',
-                    'byReference' => false,
-                    'array' => false,
-                    'optional' => false,
-                    'allowsNull' => true
-                ],
-                'param2' => [
-                    'position' => 1,
-                    'type' => 'array',
-                    'byReference' => false,
-                    'array' => true,
-                    'optional' => false,
-                    'allowsNull' => true
-                ],
-                'param3' => [
-                    'position' => 2,
-                    'type' => 'string',
-                    'byReference' => false,
-                    'array' => false,
-                    'optional' => false,
-                    'allowsNull' => true
-                ],
-            ]
-        );
-        $reflectionService->expects($this->once())->method('getMethodTagsValues')->willReturn(
-            []
-        );
-        $fixture = $this->getAccessibleMock(TestViewHelper::class, ['render', 'getReflectionService']);
-        $namedArguments = array_combine(['param1', 'param2', 'param3'], $arguments);
-        $fixture->expects($this->once())->method('getReflectionService')->willReturn($reflectionService);
-        $this->callInaccessibleMethod($fixture, 'registerRenderMethodArguments');
-        $fixture->setArguments($namedArguments);
-        if ($expectsException) {
-            $exception = new \TYPO3Fluid\Fluid\Core\ViewHelper\Exception('test', 1476108352);
-            $this->expectException(get_class($exception));
-            $fixture->expects($this->once())->method('render')->willThrowException($exception);
-            $this->assertEquals('test', $this->callInaccessibleMethod($fixture, 'callRenderMethod'));
-        } else {
-            $fixture->expects($this->once())
-                ->method('render')
-                ->with($arguments[0], $arguments[1], $arguments[2])
-                ->willReturn('okay');
-            $this->assertEquals('okay', $this->callInaccessibleMethod($fixture, 'callRenderMethod'));
-        }
-    }
-
-    /**
-     * @return array
-     */
-    public function getCallRenderMethodTestValues()
-    {
-        return [
-            [[3, ['bar'], 'baz'], false],
-            [[2, ['baz'], 'bar'], false],
-            [[3, ['bar'], 'baz'], true],
-        ];
-    }
-
-    /**
-     * @test
-     */
-    public function prepareArgumentsRegistersAnnotationBasedArgumentsWithDescriptionIfDebugModeIsEnabled()
-    {
-        $dataCacheMock = $this->createMock(\TYPO3\CMS\Core\Cache\Frontend\VariableFrontend::class);
-        $dataCacheMock->expects($this->any())->method('has')->will($this->returnValue(true));
-        $dataCacheMock->expects($this->any())->method('get')->will($this->returnValue([]));
-
-        $reflectionServiceMock = $this->getMockBuilder(ReflectionService::class)->getMock();
-        $reflectionServiceMock->expects($this->once())->method('getMethodParameters')->willReturn(['fake' => ['type' => 'int', 'defaultValue' => 'def']]);
-        $reflectionServiceMock->expects($this->once())->method('getMethodTagsValues')->willReturn(['param']);
-
-        $viewHelper = $this->getMockBuilder(\TYPO3\CMS\Fluid\Tests\Unit\Core\Fixtures\TestViewHelper::class)->setMethods(['getReflectionService'])->getMock();
-        $viewHelper->expects($this->once())->method('getReflectionService')->willReturn($reflectionServiceMock);
-
-        $expected = [
-            'fake' => new \TYPO3\CMS\Fluid\Core\ViewHelper\ArgumentDefinition('fake', 'int', '', false, 'def', true)
-        ];
-
-        $this->callInaccessibleMethod($viewHelper, 'registerRenderMethodArguments');
-        $this->assertAttributeEquals($expected, 'argumentDefinitions', $viewHelper, 'Annotation based arguments were not registered.');
-    }
-}
index fbff0d2..aa313ae 100644 (file)
@@ -17,6 +17,7 @@ namespace TYPO3\CMS\Form\ViewHelpers;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper as FluidFormViewHelper;
 use TYPO3Fluid\Fluid\Core\ViewHelper\TagBuilder;
 
@@ -37,7 +38,7 @@ class FormViewHelper extends FluidFormViewHelper
      */
     protected function renderHiddenReferrerFields()
     {
-        $tagBuilder = $this->objectManager->get(TagBuilder::class, 'input');
+        $tagBuilder = GeneralUtility::makeInstance(TagBuilder::class, 'input');
         $tagBuilder->addAttribute('type', 'hidden');
         $stateName = $this->prefixFieldName($this->arguments['object']->getFormDefinition()->getIdentifier()) . '[__state]';
         $tagBuilder->addAttribute('name', $stateName);