‪TYPO3CMS  9.5
L10nModeUpdaterTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
19 use TYPO3\TestingFramework\Core\Functional\FunctionalTestCase;
20 
24 class ‪L10nModeUpdaterTest extends FunctionalTestCase
25 {
29  protected ‪$scenarioDataSetDirectory = 'typo3/sysext/install/Tests/Functional/Updates/RowUpdater/DataSet/';
30 
34  protected ‪$assertionDataSetDirectory = 'typo3/sysext/install/Tests/Functional/Updates/RowUpdater/DataSet/';
35 
39  protected ‪$coreExtensionsToLoad = [
40  'workspaces',
41  ];
42 
47  'typo3/sysext/core/Tests/Functional/Fixtures/Extensions/irre_tutorial',
48  ];
49 
50  protected function ‪setUp()
51  {
52  parent::setUp();
53  $this->‪importScenarioDataSet('LiveDefaultPages');
54  $this->‪importScenarioDataSet('LiveDefaultElements');
55 
56  ‪$GLOBALS['TCA']['tt_content']['columns']['image']['l10n_mode'] = 'exclude';
57  ‪$GLOBALS['TCA']['tt_content']['columns']['header']['config']['behaviour']['allowLanguageSynchronization'] = true;
58  ‪$GLOBALS['TCA']['tt_content']['columns']['tx_irretutorial_1nff_hotels']['config']['behaviour']['allowLanguageSynchronization'] = true;
59  }
60 
64  protected function ‪importScenarioDataSet($dataSetName)
65  {
66  $fileName = rtrim($this->scenarioDataSetDirectory, '/') . '/' . $dataSetName . '.csv';
67  $fileName = GeneralUtility::getFileAbsFileName($fileName);
68  $this->importCSVDataSet($fileName);
69  }
70 
71  protected function ‪assertAssertionDataSet($dataSetName)
72  {
73  $fileName = rtrim($this->assertionDataSetDirectory, '/') . '/' . $dataSetName . '.csv';
74  $fileName = GeneralUtility::getFileAbsFileName($fileName);
75  $this->assertCSVDataSet($fileName);
76  }
77 
81  protected function ‪getTableNames(): array
82  {
83  return array_keys(‪$GLOBALS['TCA']);
84  }
85 
89  public function ‪recordsCanBeUpdated()
90  {
91  $updater = new ‪L10nModeUpdater();
92  foreach ($this->‪getTableNames() as $tableName) {
93  $updater->hasPotentialUpdateForTable($tableName);
94  foreach ($this->getAllRecords($tableName) as $record) {
95  $updater->updateTableRow($tableName, $record);
96  }
97  }
98 
99  $this->‪assertAssertionDataSet('recordsCanBeUpdated');
100  }
101 }
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\$assertionDataSetDirectory
‪string $assertionDataSetDirectory
Definition: L10nModeUpdaterTest.php:32
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater
Definition: L10nModeUpdaterTest.php:2
‪TYPO3\CMS\Install\Updates\RowUpdater\L10nModeUpdater
Definition: L10nModeUpdater.php:32
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\$testExtensionsToLoad
‪string[] $testExtensionsToLoad
Definition: L10nModeUpdaterTest.php:42
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\getTableNames
‪array getTableNames()
Definition: L10nModeUpdaterTest.php:77
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\$scenarioDataSetDirectory
‪string $scenarioDataSetDirectory
Definition: L10nModeUpdaterTest.php:28
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\importScenarioDataSet
‪importScenarioDataSet($dataSetName)
Definition: L10nModeUpdaterTest.php:60
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\recordsCanBeUpdated
‪recordsCanBeUpdated()
Definition: L10nModeUpdaterTest.php:85
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest
Definition: L10nModeUpdaterTest.php:25
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\setUp
‪setUp()
Definition: L10nModeUpdaterTest.php:46
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\$coreExtensionsToLoad
‪string[] $coreExtensionsToLoad
Definition: L10nModeUpdaterTest.php:36
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Install\Tests\Functional\Updates\RowUpdater\L10nModeUpdaterTest\assertAssertionDataSet
‪assertAssertionDataSet($dataSetName)
Definition: L10nModeUpdaterTest.php:67