TYPO3 CMS  TYPO3_8-7
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 
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 
46  protected $testExtensionsToLoad = [
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 }
static getFileAbsFileName($filename, $_=null, $_2=null)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']