[BUGFIX] Tests in Localization\Parser\LocallangXmlParserTest fail 50/23350/2
authorNicole Cordes <typo3@cordes.co>
Wed, 7 Aug 2013 11:27:50 +0000 (13:27 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 27 Aug 2013 09:08:41 +0000 (11:08 +0200)
If the system is already translated into French two tests in
Localization\Parser\LocallangXmlParserTest fail. This is because another
localization file is taken where test strings are not included.

As the tested functions can't work system independent, the test has to
make sure no system dependencies are used. Therefore the patch
introduces a new language "md5" to prove the workflow.

Resolves: #50870
Releases: 6.2, 6.1, 6.0
Change-Id: I64e8864a7d746c4f5c278f5e67d8dae068d8f920
Reviewed-on: https://review.typo3.org/23350
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/sysext/core/Tests/Unit/Localization/Parser/Fixtures/locallang.xml
typo3/sysext/core/Tests/Unit/Localization/Parser/LocallangXmlParserTest.php

index a5d7543..770c4cd 100644 (file)
                        <label index="label3">This is label #3</label>
                </languageKey>
 
-               <languageKey index="fr" type="array">
-                       <label index="label1">Ceci est le libellé no. 1</label>
-                       <label index="label2">Ceci est le libellé no. 2</label>
-                       <label index="label3">Ceci est le libellé no. 3</label>
+               <languageKey index="md5" type="array">
+                       <label index="label1">409a6edbc70dbeeccbfe5f1e569d6717</label>
+                       <label index="label2">b5dc71ae9f52ecb9e7704c50562e39b0</label>
+                       <label index="label3">51eac55fa5ca15789ce9bbb0cf927296</label>
                </languageKey>
        </data>
 </T3locallang>
\ No newline at end of file
index b6e1a66..3348996 100644 (file)
@@ -96,16 +96,16 @@ class LocallangXmlParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
        /**
         * @test
         */
-       public function canParseLlxmlInFrench() {
-               $LOCAL_LANG = $this->parser->getParsedData(self::getFixtureFilePath('locallang.xml'), 'fr');
-               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+       public function canParseLlxmlInMd5Code() {
+               $LOCAL_LANG = $this->parser->getParsedData(self::getFixtureFilePath('locallang.xml'), 'md5');
+               $this->assertArrayHasKey('md5', $LOCAL_LANG, 'md5 key not found in $LOCAL_LANG');
                $expectedLabels = array(
-                       'label1' => 'Ceci est le libellé no. 1',
-                       'label2' => 'Ceci est le libellé no. 2',
-                       'label3' => 'Ceci est le libellé no. 3'
+                       'label1' => '409a6edbc70dbeeccbfe5f1e569d6717',
+                       'label2' => 'b5dc71ae9f52ecb9e7704c50562e39b0',
+                       'label3' => '51eac55fa5ca15789ce9bbb0cf927296'
                );
                foreach ($expectedLabels as $key => $expectedLabel) {
-                       $this->assertEquals($expectedLabel, $LOCAL_LANG['fr'][$key][0]['target']);
+                       $this->assertEquals($expectedLabel, $LOCAL_LANG['md5'][$key][0]['target']);
                }
        }
 
@@ -129,19 +129,19 @@ class LocallangXmlParserTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
         */
        public function canOverrideLlxml() {
                $GLOBALS['TYPO3_CONF_VARS']['SYS']['locallangXMLOverride'][self::getFixtureFilePath('locallang.xml')][] = self::getFixtureFilePath('locallang_override.xml');
-               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallang.xml'), 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallang.xml'), 'fr'));
+               $LOCAL_LANG = array_merge(\TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallang.xml'), 'default'), \TYPO3\CMS\Core\Utility\GeneralUtility::readLLfile(self::getFixtureFilePath('locallang.xml'), 'md5'));
                $this->assertArrayHasKey('default', $LOCAL_LANG, 'default key not found in $LOCAL_LANG');
-               $this->assertArrayHasKey('fr', $LOCAL_LANG, 'fr key not found in $LOCAL_LANG');
+               $this->assertArrayHasKey('md5', $LOCAL_LANG, 'md5 key not found in $LOCAL_LANG');
                $expectedLabels = array(
                        'default' => array(
                                'label1' => 'This is my 1st label',
                                'label2' => 'This is my 2nd label',
                                'label3' => 'This is label #3'
                        ),
-                       'fr' => array(
-                               'label1' => 'Ceci est mon 1er libellé',
-                               'label2' => 'Ceci est le libellé no. 2',
-                               'label3' => 'Ceci est mon 3e libellé'
+                       'md5' => array(
+                               'label1' => '409a6edbc70dbeeccbfe5f1e569d6717',
+                               'label2' => 'b5dc71ae9f52ecb9e7704c50562e39b0',
+                               'label3' => '51eac55fa5ca15789ce9bbb0cf927296'
                        )
                );
                foreach ($expectedLabels as $languageKey => $expectedLanguageLabels) {