[TASK] Make LocallangXmlParserTest notice free 69/56169/4
authorSascha Löffler <lsascha@gmail.com>
Thu, 15 Mar 2018 14:22:19 +0000 (15:22 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 15 Mar 2018 15:19:28 +0000 (16:19 +0100)
Resolves: #84283
Releases: master
Change-Id: I9a047f95ca3cc57d951a36d5b9910678900e100f
Reviewed-on: https://review.typo3.org/56169
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Tested-by: TYPO3com <no-reply@typo3.com>
typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php

index 75b79a9..1b7e2ce 100644 (file)
@@ -1,4 +1,5 @@
 <?php
+declare(strict_types = 1);
 namespace TYPO3\CMS\Core\Tests\Unit\Localization\Parser;
 
 /*
@@ -29,11 +30,6 @@ use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
 class LocallangXmlParserTest extends UnitTestCase
 {
     /**
-     * Subject is not notice free, disable E_NOTICES
-     */
-    protected static $suppressNotices = true;
-
-    /**
      * Prepares the environment before running a test.
      */
     protected function setUp()
@@ -103,15 +99,16 @@ class LocallangXmlParserTest extends UnitTestCase
      */
     public function canParseLlxmlInFrenchAndReturnsNullLabelsIfNoTranslationIsFound()
     {
-        $LOCAL_LANG = (new LocallangXmlParser)->getParsedData(self::getFixtureFilePath('locallangOnlyDefaultLanguage.xml'), 'fr');
-        $expectedLabels = [
-            'label1' => null,
-            'label2' => null,
-            'label3' => null
-        ];
-        foreach ($expectedLabels as $key => $expectedLabel) {
-            $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
-        }
+        $localLang = (new LocallangXmlParser)->getParsedData(
+            self::getFixtureFilePath('locallangOnlyDefaultLanguage.xml'),
+            'fr'
+        );
+        // This test case is odd: The system under test does NOT
+        // return 'target' at all if there is no such translation.
+        // @todo: Either change / fix subject, or adapt test and test name!
+        $this->assertNull($localLang['fr']['label1'][0]['target'] ?? null);
+        $this->assertNull($localLang['fr']['label2'][0]['target'] ?? null);
+        $this->assertNull($localLang['fr']['label3'][0]['target'] ?? null);
     }
 
     /**