/**
  * @test
  */
 function mergeLocallangXmlWithXlf()
 {
     $this->markTestSkipped('The support for merging xml files with xlf is postponed.');
     $existingFile = t3lib_extmgm::extPath('extension_builder') . 'Tests/Examples/Tools/existing_locallang.xml';
     $newXlf = "<?xml version='1.0' encoding='utf-8' standalone='yes' ?>\n\t\t\t<xliff version='1.0'>\n\t\t\t\t<file source-language='en' datatype='plaintext' original='messages' date='2012-03-47T19:00:47Z' product-name='test123'>\n\t\t\t\t\t<header/>\n\t\t\t\t\t<body>\n\t\t\t\t\t\t<trans-unit id='tx_test_index1'>\n\t\t\t\t\t\t\t<source>Label 1</source>\n\t\t\t\t\t\t</trans-unit>\n\t\t\t\t\t\t<trans-unit id='tx_test_index3'>\n\t\t\t\t\t\t\t<source>Additional label 3</source>\n\t\t\t\t\t\t</trans-unit>\n\t\t\t\t\t</body>\n\t\t\t\t</file>\n\t\t\t</xliff>";
     $result = Tx_ExtensionBuilder_Utility_Tools::mergeLocallangXml($existingFile, $newXlf, 'xlf');
     $expected = array('tx_test_index1' => 'Label 1 modified', 'tx_test_index3' => 'Additional label 3', 'tx_test_index2' => 'Label 2');
     $this->assertEquals($result, $expected);
 }
 /**
  * @param string $fileNameSuffix
  * @param string $variableName
  * @param null $variable
  * @return mixed
  */
 protected function generateLocallangFileContent($fileNameSuffix = '', $variableName = '', $variable = NULL)
 {
     $targetFile = 'Resources/Private/Language/locallang' . $fileNameSuffix;
     $variableArray = array('extension' => $this->extension);
     if (strlen($variableName) > 0) {
         $variableArray[$variableName] = $variable;
     }
     if ($this->roundTripEnabled && Tx_ExtensionBuilder_Service_RoundTrip::getOverWriteSettingForPath($targetFile . '.' . $this->locallangFileFormat, $this->extension) == 1) {
         $existingFile = NULL;
         $filenameToLookFor = $this->extensionDirectory . $targetFile;
         if ($variableName == 'domainObject') {
             $filenameToLookFor .= '_' . $variable->getDatabaseTableName();
         }
         if (file_exists($filenameToLookFor . '.xlf')) {
             $existingFile = $filenameToLookFor . '.xlf';
         } else {
             if (file_exists($filenameToLookFor . '.xml')) {
                 $existingFile = $filenameToLookFor . '.xml';
             }
         }
         if ($existingFile != NULL) {
             $defaultFileContent = $this->renderTemplate($targetFile . '.' . $this->locallangFileFormat . 't', $variableArray);
             if ($this->locallangFileFormat == 'xlf') {
                 throw new Exception('Merging xlf files is not yet supported. Please set overwrite settings to "keep" or "overwrite"');
                 // this is prepared already but still needs some improvements
                 //$labelArray = Tx_ExtensionBuilder_Utility_Tools::mergeLocallangXml($existingFile, $defaultFileContent, $this->locallangFileFormat);
                 //$variableArray['labelArray'] = $labelArray;
             } else {
                 return Tx_ExtensionBuilder_Utility_Tools::mergeLocallangXml($existingFile, $defaultFileContent);
             }
         }
     }
     return $this->renderTemplate($targetFile . '.' . $this->locallangFileFormat . 't', $variableArray);
 }