[TASK] Add test for (wrong) unique eval handling in pages:alias
[Packages/TYPO3.CMS.git] / typo3 / sysext / core / Tests / Functional / DataHandling / DataHandler / GetUniqueTranslationTest.php
1 <?php
2 declare(strict_types = 1);
3
4 namespace TYPO3\CMS\Core\Tests\Functional\DataHandling\DataHandler;
5
6 use TYPO3\CMS\Backend\Utility\BackendUtility;
7 use TYPO3\CMS\Core\Tests\Functional\DataHandling\AbstractDataHandlerActionTestCase;
8
9 class GetUniqueTranslationTest extends AbstractDataHandlerActionTestCase
10 {
11 /**
12 * @var int
13 */
14 const PAGE_DATAHANDLER = 88;
15
16 /**
17 * @var string
18 */
19 protected $scenarioDataSetDirectory = 'typo3/sysext/core/Tests/Functional/DataHandling/DataHandler/DataSet/';
20
21 protected function setUp()
22 {
23 parent::setUp();
24 $this->importScenarioDataSet('LiveDefaultPages');
25 $this->importScenarioDataSet('LiveDefaultElements');
26 $this->backendUser->workspace = 0;
27 }
28
29 /**
30 * @test
31 */
32 public function valueOfUniqueFieldExcludedInTranslationIsUntouchedInTranslation(): void
33 {
34 $map = $this->actionService->localizeRecord('pages', self::PAGE_DATAHANDLER, 1);
35 $newPageId = $map['pages'][self::PAGE_DATAHANDLER];
36 $originalLanguageRecord = BackendUtility::getRecord('pages', self::PAGE_DATAHANDLER);
37 $translatedRecord = BackendUtility::getRecord('pages', $newPageId);
38
39 $this->assertEquals('datahandler', $originalLanguageRecord['alias']);
40 $this->assertEquals('datahandler0', $translatedRecord['alias']);
41 }
42 }