[TASK] Make TypolinkViewHelper notice free 52/56252/2
authorJan Helke <typo3@helke.de>
Fri, 16 Mar 2018 19:20:34 +0000 (20:20 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 16 Mar 2018 19:51:19 +0000 (20:51 +0100)
Releases: master
Resolves: #84373
Change-Id: I793ef881ef085c80f6c90a8281f6a88dcc56d642
Reviewed-on: https://review.typo3.org/56252
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/fluid/Classes/ViewHelpers/Link/TypolinkViewHelper.php
typo3/sysext/fluid/Tests/Unit/ViewHelpers/Link/TypolinkViewHelperTest.php

index 97b4d0d..bd4102e 100644 (file)
@@ -92,17 +92,17 @@ class TypolinkViewHelper extends AbstractViewHelper
      */
     public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
     {
-        $parameter = $arguments['parameter'];
-        $target = $arguments['target'];
-        $class = $arguments['class'];
-        $title = $arguments['title'];
-        $additionalParams = $arguments['additionalParams'];
-        $additionalAttributes = $arguments['additionalAttributes'];
-        $useCacheHash = $arguments['useCacheHash'];
-        $addQueryString = $arguments['addQueryString'];
-        $addQueryStringMethod = $arguments['addQueryStringMethod'];
-        $addQueryStringExclude = $arguments['addQueryStringExclude'];
-        $absolute = $arguments['absolute'];
+        $parameter = $arguments['parameter'] ?? '';
+        $target = $arguments['target'] ?? '';
+        $class = $arguments['class'] ?? '';
+        $title = $arguments['title'] ?? '';
+        $additionalParams = $arguments['additionalParams'] ?? '';
+        $additionalAttributes = $arguments['additionalAttributes'] ?? [];
+        $useCacheHash = $arguments['useCacheHash'] ?? false;
+        $addQueryString = $arguments['addQueryString'] ?? false;
+        $addQueryStringMethod = $arguments['addQueryStringMethod'] ?? 'GET';
+        $addQueryStringExclude = $arguments['addQueryStringExclude'] ?? '';
+        $absolute = $arguments['absolute'] ?? false;
 
         // Merge the $parameter with other arguments
         $typolinkParameter = self::createTypolinkParameterArrayFromArguments($parameter, $target, $class, $title, $additionalParams);
index 2b24230..18f0f05 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types=1);
 namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Link;
 
 /*
@@ -16,6 +17,7 @@ namespace TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\Link;
 
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Fluid\Core\Rendering\RenderingContext;
+use TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture;
 use TYPO3\CMS\Fluid\ViewHelpers\Link\TypolinkViewHelper;
 use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
 use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
@@ -26,11 +28,6 @@ use TYPO3\TestingFramework\Fluid\Unit\ViewHelpers\ViewHelperBaseTestcase;
 class TypolinkViewHelperTest extends ViewHelperBaseTestcase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var TypolinkViewHelper|\PHPUnit_Framework_MockObject_MockObject|\TYPO3\TestingFramework\Core\AccessibleObjectInterface
      */
     protected $subject;
@@ -42,7 +39,7 @@ class TypolinkViewHelperTest extends ViewHelperBaseTestcase
     {
         $this->subject = $this->getAccessibleMock(TypolinkViewHelper::class, ['renderChildren']);
         /** @var RenderingContext $renderingContext */
-        $renderingContext = $this->createMock(\TYPO3\CMS\Fluid\Tests\Unit\Core\Rendering\RenderingContextFixture::class);
+        $renderingContext = $this->createMock(RenderingContextFixture::class);
         $this->subject->setRenderingContext($renderingContext);
     }