[TASK] Add test for (wrong) unique eval handling in pages:alias 22/57322/4
authorAndreas Wolf <dev@a-w.io>
Fri, 22 Jun 2018 22:13:48 +0000 (00:13 +0200)
committerBenni Mack <benni@typo3.org>
Sun, 28 Oct 2018 15:00:37 +0000 (16:00 +0100)
Change-Id: Ie47dbc9153d8a4dcbde15a7eb61c207bbcc34480
Resolves: #86780
Related: #84267
Related: #83572
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/57322
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/LiveDefaultPages.csv
typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/GetUniqueTranslationTest.php [new file with mode: 0644]

index 335d96c..badf239 100644 (file)
@@ -1,6 +1,6 @@
-"pages",,,,,,,,,,,
-,"uid","pid","sorting","deleted","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","t3ver_move_id","title"
-,1,0,256,0,0,0,0,0,0,0,"FunctionalTest"
-,88,1,256,0,0,0,0,0,0,0,"DataHandlerTest"
-,89,88,256,0,0,0,0,0,0,0,"Relations"
-,90,88,512,0,0,0,0,0,0,0,"Target"
+"pages",,,,,,,,,,,,
+,"uid","pid","sorting","deleted","t3_origuid","t3ver_wsid","t3ver_state","t3ver_stage","t3ver_oid","t3ver_move_id","title","alias"
+,1,0,256,0,0,0,0,0,0,0,"FunctionalTest","functional"
+,88,1,256,0,0,0,0,0,0,0,"DataHandlerTest","datahandler"
+,89,88,256,0,0,0,0,0,0,0,"Relations","relations"
+,90,88,512,0,0,0,0,0,0,0,"Target","target"
diff --git a/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/GetUniqueTranslationTest.php b/typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/GetUniqueTranslationTest.php
new file mode 100644 (file)
index 0000000..85d3fde
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+declare(strict_types = 1);
+
+namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler;
+
+use TYPO3\CMS\Backend\Utility\BackendUtility;
+use TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase;
+
+class GetUniqueTranslationTest extends AbstractDataHandlerActionTestCase
+{
+    /**
+     * @var int
+     */
+    const PAGE_DATAHANDLER = 88;
+
+    /**
+     * @var string
+     */
+    protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/';
+
+    protected function setUp()
+    {
+        parent::setUp();
+        $this->importScenarioDataSet('LiveDefaultPages');
+        $this->importScenarioDataSet('LiveDefaultElements');
+        $this->backendUser->workspace = 0;
+    }
+
+    /**
+     * @test
+     */
+    public function valueOfUniqueFieldExcludedInTranslationIsUntouchedInTranslation(): void
+    {
+        $map = $this->actionService->localizeRecord('pages', self::PAGE_DATAHANDLER, 1);
+        $newPageId = $map['pages'][self::PAGE_DATAHANDLER];
+        $originalLanguageRecord = BackendUtility::getRecord('pages', self::PAGE_DATAHANDLER);
+        $translatedRecord = BackendUtility::getRecord('pages', $newPageId);
+
+        $this->assertEquals('datahandler', $originalLanguageRecord['alias']);
+        $this->assertEquals('datahandler0', $translatedRecord['alias']);
+    }
+}