[TASK] Make FormEditorControllerTest notice free 68/56268/2
authorJan Helke <typo3@helke.de>
Sat, 17 Mar 2018 08:29:19 +0000 (09:29 +0100)
committerTymoteusz Motylewski <t.motylewski@gmail.com>
Sat, 17 Mar 2018 09:13:26 +0000 (10:13 +0100)
Releases: master
Resolves: #84390
Change-Id: I02b5861bae1ee15ef6491daf3a0c970e2ca71617
Reviewed-on: https://review.typo3.org/56268
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: Tymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski <t.motylewski@gmail.com>
typo3/sysext/form/Classes/Controller/FormEditorController.php
typo3/sysext/form/Tests/Unit/Controller/FormEditorControllerTest.php

index 244cd24..8887907 100644 (file)
@@ -230,7 +230,7 @@ class FormEditorController extends AbstractBackendController
 
             $formElementConfiguration = TranslationService::getInstance()->translateValuesRecursive(
                 $formElementConfiguration,
-                $this->prototypeConfiguration['formEditor']['translationFile']
+                $this->prototypeConfiguration['formEditor']['translationFile'] ?? null
             );
 
             $formElementsByGroup[$formElementConfiguration['group']][] = [
@@ -255,7 +255,7 @@ class FormEditorController extends AbstractBackendController
 
             $groupConfiguration = TranslationService::getInstance()->translateValuesRecursive(
                 $groupConfiguration,
-                $this->prototypeConfiguration['formEditor']['translationFile']
+                $this->prototypeConfiguration['formEditor']['translationFile'] ?? null
             );
 
             $formGroups[] = [
@@ -295,7 +295,7 @@ class FormEditorController extends AbstractBackendController
         $formEditorDefinitions = ArrayUtility::reIndexNumericArrayKeysRecursive($formEditorDefinitions);
         $formEditorDefinitions = TranslationService::getInstance()->translateValuesRecursive(
             $formEditorDefinitions,
-            $this->prototypeConfiguration['formEditor']['translationFile']
+            $this->prototypeConfiguration['formEditor']['translationFile'] ?? null
         );
         return $formEditorDefinitions;
     }
@@ -380,8 +380,8 @@ class FormEditorController extends AbstractBackendController
      */
     protected function renderFormEditorTemplates(array $formEditorDefinitions): string
     {
-        $fluidConfiguration = $this->prototypeConfiguration['formEditor']['formEditorFluidConfiguration'];
-        $formEditorPartials = $this->prototypeConfiguration['formEditor']['formEditorPartials'];
+        $fluidConfiguration = $this->prototypeConfiguration['formEditor']['formEditorFluidConfiguration'] ?? null;
+        $formEditorPartials = $this->prototypeConfiguration['formEditor']['formEditorPartials'] ?? null;
 
         if (!isset($fluidConfiguration['templatePathAndFilename'])) {
             throw new RenderingException(
index 5a5f951..9e7786e 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Form\Tests\Unit\Controller;
 
 /*
@@ -19,18 +20,14 @@ use TYPO3\CMS\Extbase\Object\ObjectManager;
 use TYPO3\CMS\Form\Controller\FormEditorController;
 use TYPO3\CMS\Form\Domain\Exception\RenderingException;
 use TYPO3\CMS\Form\Service\TranslationService;
+use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 
 /**
  * Test case
  */
-class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
+class FormEditorControllerTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * @var array A backup of registered singleton instances
      */
     protected $singletonInstances = [];
@@ -55,7 +52,7 @@ class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     /**
      * @test
      */
-    public function getInsertRenderablesPanelConfigurationReturnsGroupedAndSortedConfiguration()
+    public function getInsertRenderablesPanelConfigurationReturnsGroupedAndSortedConfiguration(): void
     {
         $mockController = $this->getAccessibleMock(FormEditorController::class, [
             'dummy'
@@ -153,7 +150,7 @@ class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     /**
      * @test
      */
-    public function getFormEditorDefinitionsReturnReducedConfiguration()
+    public function getFormEditorDefinitionsReturnReducedConfiguration(): void
     {
         $mockController = $this->getAccessibleMock(FormEditorController::class, [
             'dummy'
@@ -287,7 +284,7 @@ class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     /**
      * @test
      */
-    public function renderFormEditorTemplatesThrowsExceptionIfLayoutRootPathsNotSet()
+    public function renderFormEditorTemplatesThrowsExceptionIfLayoutRootPathsNotSet(): void
     {
         $this->expectException(RenderingException::class);
         $this->expectExceptionCode(1480294721);
@@ -310,7 +307,7 @@ class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     /**
      * @test
      */
-    public function renderFormEditorTemplatesThrowsExceptionIfLayoutRootPathsNotArray()
+    public function renderFormEditorTemplatesThrowsExceptionIfLayoutRootPathsNotArray(): void
     {
         $this->expectException(RenderingException::class);
         $this->expectExceptionCode(1480294721);
@@ -334,7 +331,7 @@ class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     /**
      * @test
      */
-    public function renderFormEditorTemplatesThrowsExceptionIfPartialRootPathsNotSet()
+    public function renderFormEditorTemplatesThrowsExceptionIfPartialRootPathsNotSet(): void
     {
         $this->expectException(RenderingException::class);
         $this->expectExceptionCode(1480294722);
@@ -358,7 +355,7 @@ class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     /**
      * @test
      */
-    public function renderFormEditorTemplatesThrowsExceptionIfPartialRootPathsNotArray()
+    public function renderFormEditorTemplatesThrowsExceptionIfPartialRootPathsNotArray(): void
     {
         $this->expectException(RenderingException::class);
         $this->expectExceptionCode(1480294722);
@@ -382,7 +379,7 @@ class FormEditorControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTes
     /**
      * @test
      */
-    public function renderFormEditorTemplatesThrowsExceptionIftemplatePathAndFilenameNotSet()
+    public function renderFormEditorTemplatesThrowsExceptionIftemplatePathAndFilenameNotSet(): void
     {
         $this->expectException(RenderingException::class);
         $this->expectExceptionCode(1485636499);