[TASK] Add functional tests for copying a record into another language 47/58247/5
authorOliver Hader <oliver@typo3.org>
Mon, 10 Sep 2018 14:40:21 +0000 (16:40 +0200)
committerNicole Cordes <typo3@cordes.co>
Mon, 10 Sep 2018 18:10:27 +0000 (20:10 +0200)
The expected behavior is that the copied record is not synchronized
when modifying the language parent record (since it is not in connected
mode).

Resolves: #86215
Releases: master, 8.7
Change-Id: Ibf58dd6daf877b172aea5c31ead8ea1277834bfc
Reviewed-on: https://review.typo3.org/58247
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/core/Tests/Functional/DataHandling/Regular/AbstractActionTestCase.php
typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/ActionTest.php
typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/copyContentToLanguageWExclude.csv [new file with mode: 0644]
typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/copyContentToLanguageWSynchronization.csv [new file with mode: 0644]

index cdabe46..c57256e 100644 (file)
@@ -122,6 +122,28 @@ abstract class AbstractActionTestCase extends \TYPO3\CMS\Core\Tests\Functional\D
     }
 
     /**
+     * @see DataSet/copyContentToLanguageWSynchronization.csv
+     */
+    public function copyContentToLanguageWithLanguageSynchronization()
+    {
+        $GLOBALS['TCA']['tt_content']['columns']['header']['config']['behaviour']['allowLanguageSynchronization'] = true;
+        $copiedTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
+        $this->recordIds['localizedContentId'] = $copiedTableIds[self::TABLE_Content][self::VALUE_ContentIdSecond];
+        $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, ['header' => 'Testing #1']);
+    }
+
+    /**
+     * @see DataSet/copyContentToLanguageWExclude.csv
+     */
+    public function copyContentToLanguageWithLocalizationExclude()
+    {
+        $GLOBALS['TCA']['tt_content']['columns']['header']['l10n_mode'] = 'exclude';
+        $copiedTableIds = $this->actionService->copyRecordToLanguage(self::TABLE_Content, self::VALUE_ContentIdSecond, self::VALUE_LanguageId);
+        $this->recordIds['localizedContentId'] = $copiedTableIds[self::TABLE_Content][self::VALUE_ContentIdSecond];
+        $this->actionService->modifyRecord(self::TABLE_Content, self::VALUE_ContentIdSecond, ['header' => 'Testing #1']);
+    }
+
+    /**
      * Free mode "translation" of a record in non default language
      *
      * @see DataSet/copyContentToLanguageFromNonDefaultLanguage.csv
index 32cd9b1..68d110b 100644 (file)
@@ -135,6 +135,44 @@ class ActionTest extends \TYPO3\CMS\Core\Tests\Functional\DataHandling\Regular\A
 
     /**
      * @test
+     * @see DataSet/copyContentToLanguageWSynchronization.csv
+     */
+    public function copyContentToLanguageWithLanguageSynchronization()
+    {
+        parent::copyContentToLanguageWithLanguageSynchronization();
+        $this->assertAssertionDataSet('copyContentToLanguageWSynchronization');
+
+        $this->setUpFrontendRootPage(1, [
+            'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
+            'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.ts'
+        ]);
+        $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
+        $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
+            ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Regular Element #3', '[Translate to Dansk:] Regular Element #2'));
+    }
+
+    /**
+     * @test
+     * @see DataSet/copyContentToLanguageWExclude.csv
+     */
+    public function copyContentToLanguageWithLocalizationExclude()
+    {
+        parent::copyContentToLanguageWithLocalizationExclude();
+        $this->assertAssertionDataSet('copyContentToLanguageWExclude');
+
+        $this->setUpFrontendRootPage(1, [
+            'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRenderer.ts',
+            'typo3/sysext/core/Tests/Functional/Fixtures/Frontend/JsonRendererNoOverlay.ts'
+        ]);
+        $responseSections = $this->getFrontendResponse(self::VALUE_PageId, self::VALUE_LanguageId)->getResponseSections();
+        $this->assertThat($responseSections, $this->getRequestSectionHasRecordConstraint()
+            // @todo Currently the behavior is "correct", however might be enhanced in the future with https://review.typo3.org/#/c/58235/
+            // ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Regular Element #3', '[Translate to Dansk:] Regular Element #2'));
+            ->setTable(self::TABLE_Content)->setField('header')->setValues('[Translate to Dansk:] Regular Element #3', ''));
+    }
+
+    /**
+     * @test
      * @see DataSet/copyContentToLanguageFromNonDefaultLanguage.csv
      */
     public function copyContentToLanguageFromNonDefaultLanguage()
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/copyContentToLanguageWExclude.csv b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/copyContentToLanguageWExclude.csv
new file mode 100644 (file)
index 0000000..17bcd2a
--- /dev/null
@@ -0,0 +1,11 @@
+"tt_content",,,,,,,,,,,,,,,
+,"uid","pid","sorting","deleted","sys_language_uid","l18n_parent","l10n_source","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","t3ver_move_id","header","l10n_state"
+,296,88,256,0,0,0,0,0,0,0,0,0,0,"Regular Element #0",
+,297,89,256,0,0,0,0,0,0,0,0,0,0,"Regular Element #1",
+,298,89,512,0,0,0,0,0,0,0,0,0,0,"Testing #1",\NULL
+,299,89,768,0,0,0,0,0,0,0,0,0,0,"Regular Element #3",
+,300,89,1024,0,1,299,299,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3",
+,301,89,384,0,1,297,297,297,0,0,0,0,0,"[Translate to Dansk:] Regular Element #1",
+,302,89,448,0,2,297,301,301,0,0,0,0,0,"[Translate to Deutsch:] [Translate to Dansk:] Regular Element #1",
+#,303,89,416,0,1,0,298,298,0,0,0,0,0,"[Translate to Dansk:] Regular Element #2",
+,303,89,416,0,1,0,298,298,0,0,0,0,0,"",
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/copyContentToLanguageWSynchronization.csv b/typo3/sysext/core/Tests/Functional/DataHandling/Regular/Modify/DataSet/copyContentToLanguageWSynchronization.csv
new file mode 100644 (file)
index 0000000..fca9a07
--- /dev/null
@@ -0,0 +1,10 @@
+"tt_content",,,,,,,,,,,,,,,
+,"uid","pid","sorting","deleted","sys_language_uid","l18n_parent","l10n_source","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","t3ver_move_id","header","l10n_state"
+,296,88,256,0,0,0,0,0,0,0,0,0,0,"Regular Element #0",
+,297,89,256,0,0,0,0,0,0,0,0,0,0,"Regular Element #1",
+,298,89,512,0,0,0,0,0,0,0,0,0,0,"Testing #1",\NULL
+,299,89,768,0,0,0,0,0,0,0,0,0,0,"Regular Element #3",
+,300,89,1024,0,1,299,299,299,0,0,0,0,0,"[Translate to Dansk:] Regular Element #3",
+,301,89,384,0,1,297,297,297,0,0,0,0,0,"[Translate to Dansk:] Regular Element #1",
+,302,89,448,0,2,297,301,301,0,0,0,0,0,"[Translate to Deutsch:] [Translate to Dansk:] Regular Element #1",
+,303,89,416,0,1,0,298,298,0,0,0,0,0,"[Translate to Dansk:] Regular Element #2",