diff --git a/Build/phpstan/Core11/phpstan-baseline.neon b/Build/phpstan/Core11/phpstan-baseline.neon index 89346688..b8022556 100644 --- a/Build/phpstan/Core11/phpstan-baseline.neon +++ b/Build/phpstan/Core11/phpstan-baseline.neon @@ -265,11 +265,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Hooks/TranslateHookTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Hooks\\\\TranslateHookTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Hooks/TranslateHookTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Hooks\\\\TranslateHookTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 @@ -335,11 +330,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\GlossaryRegressionTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\GlossaryRegressionTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 @@ -375,6 +365,71 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php + - + message: "#^Class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor invoked with 3 parameters, 1\\-2 required\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildErrorHandlingConfiguration\\(\\) has parameter \\$codes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildErrorHandlingConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildLanguageConfiguration\\(\\) has parameter \\$fallbackIdentifiers with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:mergeSiteConfiguration\\(\\) has parameter \\$overrides with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$errorHandling with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$languages with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$site with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Parameter \\#1 \\$current of method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:mergeInstruction\\(\\) expects TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction, TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction\\|null given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Parameter \\#2 \\$coreCache of class TYPO3\\\\CMS\\\\Core\\\\Configuration\\\\SiteConfiguration constructor expects TYPO3\\\\CMS\\\\Core\\\\Cache\\\\Frontend\\\\PhpFrontend\\|null, Psr\\\\EventDispatcher\\\\EventDispatcherInterface given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + - message: "#^Cannot access property \\$code on DeepL\\\\Language\\|null\\.$#" count: 7 @@ -410,11 +465,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Services/LanguageServiceTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Services\\\\LanguageServiceTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Services/LanguageServiceTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Services\\\\LanguageServiceTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 @@ -480,11 +530,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 diff --git a/Build/phpstan/Core12/phpstan-baseline.neon b/Build/phpstan/Core12/phpstan-baseline.neon index d33e49dc..e7ebfab5 100644 --- a/Build/phpstan/Core12/phpstan-baseline.neon +++ b/Build/phpstan/Core12/phpstan-baseline.neon @@ -250,11 +250,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Hooks/TranslateHookTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Hooks\\\\TranslateHookTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Hooks/TranslateHookTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Hooks\\\\TranslateHookTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 @@ -310,11 +305,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\GlossaryRegressionTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\GlossaryRegressionTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 @@ -345,6 +335,61 @@ parameters: count: 1 path: ../../../Tests/Functional/Regression/GlossaryRegressionTest.php + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildDefaultLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildErrorHandlingConfiguration\\(\\) has parameter \\$codes with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildErrorHandlingConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildLanguageConfiguration\\(\\) has parameter \\$fallbackIdentifiers with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:buildLanguageConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:mergeSiteConfiguration\\(\\) has parameter \\$overrides with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$errorHandling with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$languages with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:writeSiteConfiguration\\(\\) has parameter \\$site with no value type specified in iterable type array\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + + - + message: "#^Parameter \\#1 \\$current of method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Regression\\\\LocalizationInlineRegressionTest\\:\\:mergeInstruction\\(\\) expects TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction, TYPO3\\\\TestingFramework\\\\Core\\\\Functional\\\\Framework\\\\Frontend\\\\Internal\\\\AbstractInstruction\\|null given\\.$#" + count: 1 + path: ../../../Tests/Functional/Regression/LocalizationInlineRegressionTest.php + - message: "#^Cannot access property \\$code on DeepL\\\\Language\\|null\\.$#" count: 7 @@ -375,11 +420,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Services/LanguageServiceTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Services\\\\LanguageServiceTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Services/LanguageServiceTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Services\\\\LanguageServiceTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 @@ -435,11 +475,6 @@ parameters: count: 1 path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php - - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:buildSiteConfiguration\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: ../../../Tests/Functional/Updates/FormalityUpgradeWizardTest.php - - message: "#^Method WebVision\\\\WvDeepltranslate\\\\Tests\\\\Functional\\\\Updates\\\\FormalityUpgradeWizardTest\\:\\:failIfArrayIsNotEmpty\\(\\) has parameter \\$items with no value type specified in iterable type array\\.$#" count: 1 diff --git a/Classes/Domain/Repository/GlossaryRepository.php b/Classes/Domain/Repository/GlossaryRepository.php index 76a76e89..7f711b51 100644 --- a/Classes/Domain/Repository/GlossaryRepository.php +++ b/Classes/Domain/Repository/GlossaryRepository.php @@ -418,9 +418,9 @@ protected function getTargetLanguageIsoCode(Site $site, int $languageId): string { if ((new Typo3Version())->getMajorVersion() >= 12) { return $site->getLanguageById($languageId)->getLocale()->getLanguageCode(); - } else { - return $site->getLanguageById($languageId)->getTwoLetterIsoCode(); } + return $site->getLanguageById($languageId)->getTwoLetterIsoCode(); + } /** diff --git a/Classes/Service/ProcessingInstruction.php b/Classes/Service/ProcessingInstruction.php index c793b760..00582520 100644 --- a/Classes/Service/ProcessingInstruction.php +++ b/Classes/Service/ProcessingInstruction.php @@ -29,6 +29,14 @@ public function setProcessingInstruction(?string $table = null, $id = null, $dee 'id' => $id, 'deeplMode' => $deeplMode, ]; + // if processing instructions are already set, detect the current DeepL mode. + // this is needed for sub instances of DataHandler, mostly + // when translating inline elements via command and the DataMapProcessor + // manually triggers an inline translation + // which leads to loss of deepl mode information from original request + if ($this->runtimeCache->has(self::PROCESSING_CACHE_IDENTIFIER)) { + $processingInformation['deeplMode'] = $this->isDeeplMode(); + } $this->runtimeCache->set(self::PROCESSING_CACHE_IDENTIFIER, $processingInformation); } diff --git a/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php b/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php index 7a243c6a..886b0eab 100644 --- a/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php +++ b/Tests/Functional/Fixtures/Traits/SiteBasedTestTrait.php @@ -77,6 +77,23 @@ protected function mergeSiteConfiguration( } } + /** + * @param array $additionalRootConfiguration + * @return array + */ + protected function buildSiteConfiguration( + int $rootPageId, + string $base = '', + string $websiteTitle='', + array $additionalRootConfiguration = [] + ): array { + return array_merge([ + 'rootPageId' => $rootPageId, + 'base' => $base, + 'websiteTitle' => $websiteTitle, + ], $additionalRootConfiguration); + } + protected function createSiteConfiguration(string $path): SiteConfiguration { if ((new Typo3Version())->getMajorVersion() < 12) { @@ -93,18 +110,6 @@ protected function createSiteConfiguration(string $path): SiteConfiguration ); } - protected function buildSiteConfiguration( - int $rootPageId, - string $base = '', - string $websiteTitle='' - ): array { - return [ - 'rootPageId' => $rootPageId, - 'base' => $base, - 'websiteTitle' => $websiteTitle, - ]; - } - protected function buildDefaultLanguageConfiguration( string $identifier, string $base diff --git a/Tests/Functional/Fixtures/be_users.csv b/Tests/Functional/Fixtures/be_users.csv new file mode 100644 index 00000000..bfc3c6b5 --- /dev/null +++ b/Tests/Functional/Fixtures/be_users.csv @@ -0,0 +1,4 @@ +"be_users" +,"uid","pid","tstamp","username","password","admin","disable","starttime","endtime","options","crdate","workspace_perms","deleted","TSconfig","lastlogin","workspace_id" +# The password is "password" +,1,0,1366642540,"admin","$1$tCrlLajZ$C0sikFQQ3SWaFAZ1Me0Z/1",1,0,0,0,0,1366642540,1,0,,1371033743,0 \ No newline at end of file diff --git a/Tests/Functional/Regression/Fixtures/Files/clear.gif b/Tests/Functional/Regression/Fixtures/Files/clear.gif new file mode 100644 index 00000000..e1d2d832 Binary files /dev/null and b/Tests/Functional/Regression/Fixtures/Files/clear.gif differ diff --git a/Tests/Functional/Regression/Fixtures/Results/pageWithMediaResult.csv b/Tests/Functional/Regression/Fixtures/Results/pageWithMediaResult.csv new file mode 100644 index 00000000..e0ad9055 --- /dev/null +++ b/Tests/Functional/Regression/Fixtures/Results/pageWithMediaResult.csv @@ -0,0 +1,8 @@ +pages +,uid,pid,title,sys_language_uid,l10n_parent,doktype,media +,1,0,"proton beam",0,0,1,1 +,2,0,"Protonenstrahl",1,1,1,1 +sys_file_reference +,uid,pid,uid_local,uid_foreign,tablenames,fieldname,sys_language_uid,title,l10n_parent +,1,1,1,1,pages,media,0,"proton beam",0 +,2,1,1,2,pages,media,1,"Protonenstrahl",1 diff --git a/Tests/Functional/Regression/Fixtures/localizationInline.csv b/Tests/Functional/Regression/Fixtures/localizationInline.csv new file mode 100644 index 00000000..001191c9 --- /dev/null +++ b/Tests/Functional/Regression/Fixtures/localizationInline.csv @@ -0,0 +1,12 @@ +pages +,"uid","pid","title","sys_language_uid","slug","media" +,1,0,"proton beam",0,"/",1 +sys_file +,uid,pid,name,identifier,storage +,1,0,clear.gif,/clear.gif,1 +sys_file_metadata +,uid,pid,file +,1,0,1 +sys_file_reference +,uid,pid,uid_local,uid_foreign,tablenames,fieldname,sys_language_uid,title,l10n_parent +,1,1,1,1,pages,media,0,"proton beam",0 diff --git a/Tests/Functional/Regression/GlossaryRegressionTest.php b/Tests/Functional/Regression/GlossaryRegressionTest.php index 1b64d45f..14ba6209 100644 --- a/Tests/Functional/Regression/GlossaryRegressionTest.php +++ b/Tests/Functional/Regression/GlossaryRegressionTest.php @@ -93,7 +93,7 @@ public function glossaryIsRespectedOnLocalization(): void $dataHandler->start([], $commandMap); $dataHandler->process_cmdmap(); - self::assertEmpty($dataHandler->errorLog); + static::assertEmpty($dataHandler->errorLog); self::assertCSVDataSet(__DIR__ . '/Fixtures/Results/translateWithGlossary.csv'); } } diff --git a/Tests/Functional/Regression/LocalizationInlineRegressionTest.php b/Tests/Functional/Regression/LocalizationInlineRegressionTest.php new file mode 100644 index 00000000..f173d794 --- /dev/null +++ b/Tests/Functional/Regression/LocalizationInlineRegressionTest.php @@ -0,0 +1,114 @@ + [ + 'id' => 0, + 'title' => 'English', + 'locale' => 'en_US.UTF-8', + 'iso' => 'en', + 'hrefLang' => 'en-US', + 'direction' => '', + 'custom' => [ + 'deeplTargetLanguage' => '', + 'deeplAllowedAutoTranslate' => false, + 'deeplAllowedReTranslate' => false, + ], + ], + 'DE' => [ + 'id' => 1, + 'title' => 'Deutsch', + 'locale' => 'de_DE', + 'iso' => 'de', + 'hrefLang' => 'de-DE', + 'direction' => '', + 'custom' => [ + 'deeplTargetLanguage' => 'DE', + 'deeplAllowedAutoTranslate' => true, + 'deeplAllowedReTranslate' => true, + ], + ], + ]; + + protected array $configurationToUseInTestInstance = [ + 'EXTENSIONS' => [ + 'wv_deepltranslate' => [ + 'apiKey' => 'mock_server', + ], + ], + ]; + + protected array $pathsToProvideInTestInstance = [ + 'typo3conf/ext/wv_deepltranslate/Tests/Functional/Regression/Fixtures/Files' => 'fileadmin', + ]; + + protected function setUp(): void + { + parent::setUp(); + + $this->importCSVDataSet(__DIR__ . '/Fixtures/localizationInline.csv'); + $this->importCSVDataSet(__DIR__ . '/../Fixtures/be_users.csv'); + + $site = $this->buildSiteConfiguration(1, '/', 'Home', [ + 'deeplAllowedAutoTranslate' => true, + 'deeplAllowedReTranslate' => true, + ]); + + $this->writeSiteConfiguration( + 'acme', + $site, + [ + $this->buildDefaultLanguageConfiguration('EN', '/'), + $this->buildLanguageConfiguration('DE', '/de/', ['EN'], 'strict'), + ] + ); + + $this->setUpBackendUser(1); + $GLOBALS['LANG'] = GeneralUtility::makeInstance(LanguageServiceFactory::class) + ->createFromUserPreferences($GLOBALS['BE_USER']); + } + + /** @test */ + public function ensureInlineElementsTranslationOnLocalization(): void + { + $commandMap = [ + 'localization' => [ + 'custom' => [ + 'mode' => 'deepl', + ], + ], + 'pages' => [ + 1 => [ + 'localize' => 1, + ], + ], + ]; + $dataHandler = GeneralUtility::makeInstance(DataHandler::class); + $dataHandler->start([], $commandMap); + $dataHandler->process_cmdmap(); + + static::assertEmpty($dataHandler->errorLog); + self::assertCSVDataSet(__DIR__ . '/Fixtures/Results/pageWithMediaResult.csv'); + } +}