‪TYPO3CMS  10.4
DatabaseDefaultLanguagePageRowTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪DatabaseDefaultLanguagePageRowTest extends UnitTestCase
27 {
31  protected ‪$subject;
32 
33  protected function ‪setUp(): void
34  {
35  ‪$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'] = 'l10n_parent';
36  $this->subject = $this->getMockBuilder(DatabaseDefaultLanguagePageRow::class)
37  ->setMethods(['getDatabaseRow'])
38  ->getMock();
39  }
40 
45  {
46  $input = [
47  'tableName' => 'tx_doandroidsdreamofelectricsheep',
48  'databaseRow' => [
49  'uid' => 23,
50  'l10n_parent' => 13,
51  'sys_language_uid' => 23
52  ]
53  ];
54  $result = $this->subject->addData($input);
55 
56  self::assertArrayNotHasKey('defaultLanguagePageRow', $result);
57  }
58 
63  {
64  $input = [
65  'tableName' => 'pages',
66  'databaseRow' => [
67  'uid' => 23,
68  'l10n_parent' => 0,
69  'sys_language_uid' => 0
70  ]
71  ];
72  $result = $this->subject->addData($input);
73  self::assertSame($input, $result);
74  }
75 
80  {
81  $input = [
82  'tableName' => 'pages',
83  'databaseRow' => [
84  'uid' => 23,
85  'pid' => 1,
86  'l10n_parent' => 13,
87  'sys_language_uid' => 8
88  ]
89  ];
90 
91  $defaultLanguagePageRow = [
92  'uid' => 13,
93  'pid' => 1,
94  'sys_language_uid' => 0,
95  'l10n_parent' => 0
96  ];
97 
98  $this->subject->expects(self::once())
99  ->method('getDatabaseRow')
100  ->with($input['tableName'], 13)
101  ->willReturn($defaultLanguagePageRow);
102 
103  $result = $this->subject->addData($input);
104  self::assertEquals($defaultLanguagePageRow, $result['defaultLanguagePageRow']);
105  }
106 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\setUp
‪setUp()
Definition: DatabaseDefaultLanguagePageRowTest.php:32
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest
Definition: DatabaseDefaultLanguagePageRowTest.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\addDataDoesApplyToAPagesTableButNoChangeForDefaultLanguage
‪addDataDoesApplyToAPagesTableButNoChangeForDefaultLanguage()
Definition: DatabaseDefaultLanguagePageRowTest.php:61
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseDefaultLanguagePageRow
Definition: DatabaseDefaultLanguagePageRow.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\addDataDoesNotApplyToAnyNonPagesTable
‪addDataDoesNotApplyToAnyNonPagesTable()
Definition: DatabaseDefaultLanguagePageRowTest.php:43
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\addDataDoesApplyToATranslatedPagesTable
‪addDataDoesApplyToATranslatedPagesTable()
Definition: DatabaseDefaultLanguagePageRowTest.php:78
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\$subject
‪DatabaseDefaultLanguagePageRow PHPUnit Framework MockObject MockObject $subject
Definition: DatabaseDefaultLanguagePageRowTest.php:30
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18