‪TYPO3CMS  9.5
DatabaseDefaultLanguagePageRowTest.php
Go to the documentation of this file.
1 <?php
2 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 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪DatabaseDefaultLanguagePageRowTest extends UnitTestCase
25 {
29  protected ‪$subject;
30 
31  protected function ‪setUp()
32  {
33  ‪$GLOBALS['TCA']['pages']['ctrl']['transOrigPointerField'] = 'l10n_parent';
34  $this->subject = $this->getMockBuilder(DatabaseDefaultLanguagePageRow::class)
35  ->setMethods(['getDatabaseRow'])
36  ->getMock();
37  }
38 
43  {
44  $input = [
45  'tableName' => 'tx_doandroidsdreamofelectricsheep',
46  'databaseRow' => [
47  'uid' => 23,
48  'l10n_parent' => 13,
49  'sys_language_uid' => 23
50  ]
51  ];
52  $result = $this->subject->addData($input);
53 
54  $this->assertArrayNotHasKey('defaultLanguagePageRow', $result);
55  }
56 
61  {
62  $input = [
63  'tableName' => 'pages',
64  'databaseRow' => [
65  'uid' => 23,
66  'l10n_parent' => 0,
67  'sys_language_uid' => 0
68  ]
69  ];
70  $result = $this->subject->addData($input);
71  $this->assertSame($input, $result);
72  }
73 
78  {
79  $input = [
80  'tableName' => 'pages',
81  'databaseRow' => [
82  'uid' => 23,
83  'pid' => 1,
84  'l10n_parent' => 13,
85  'sys_language_uid' => 8
86  ]
87  ];
88 
89  $defaultLanguagePageRow = [
90  'uid' => 13,
91  'pid' => 1,
92  'sys_language_uid' => 0,
93  'l10n_parent' => 0
94  ];
95 
96  $this->subject->expects($this->once())
97  ->method('getDatabaseRow')
98  ->with($input['tableName'], 13)
99  ->willReturn($defaultLanguagePageRow);
100 
101  $result = $this->subject->addData($input);
102  $this->assertEquals($defaultLanguagePageRow, $result['defaultLanguagePageRow']);
103  }
104 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\setUp
‪setUp()
Definition: DatabaseDefaultLanguagePageRowTest.php:30
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\$subject
‪DatabaseDefaultLanguagePageRow PHPUnit_Framework_MockObject_MockObject $subject
Definition: DatabaseDefaultLanguagePageRowTest.php:28
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest
Definition: DatabaseDefaultLanguagePageRowTest.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\addDataDoesApplyToAPagesTableButNoChangeForDefaultLanguage
‪addDataDoesApplyToAPagesTableButNoChangeForDefaultLanguage()
Definition: DatabaseDefaultLanguagePageRowTest.php:59
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseDefaultLanguagePageRow
Definition: DatabaseDefaultLanguagePageRow.php:24
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\addDataDoesNotApplyToAnyNonPagesTable
‪addDataDoesNotApplyToAnyNonPagesTable()
Definition: DatabaseDefaultLanguagePageRowTest.php:41
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseDefaultLanguagePageRowTest\addDataDoesApplyToATranslatedPagesTable
‪addDataDoesApplyToATranslatedPagesTable()
Definition: DatabaseDefaultLanguagePageRowTest.php:76
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:3