‪TYPO3CMS  9.5
DatabaseEffectivePidTest.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 
18 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19 
23 class ‪DatabaseEffectivePidTest extends UnitTestCase
24 {
28  protected ‪$subject;
29 
30  protected function ‪setUp()
31  {
32  $this->subject = new ‪DatabaseEffectivePid();
33  }
34 
39  {
40  $input = [
41  'command' => 'edit',
42  'tableName' => 'pages',
43  'databaseRow' => [
44  'uid' => 123,
45  ],
46  ];
47  $expected = $input;
48  $expected['effectivePid'] = 123;
49  $this->assertSame($expected, $this->subject->addData($input));
50  }
51 
56  {
57  $input = [
58  'command' => 'edit',
59  'tableName' => 'tt_content',
60  'databaseRow' => [
61  'pid' => 123,
62  ],
63  ];
64  $expected = $input;
65  $expected['effectivePid'] = 123;
66  $this->assertSame($expected, $this->subject->addData($input));
67  }
68 
73  {
74  $input = [
75  'command' => 'new',
76  'tableName' => 'tt_content',
77  'parentPageRow' => [
78  'uid' => 123
79  ],
80  ];
81  $expected = $input;
82  $expected['effectivePid'] = 123;
83  $this->assertSame($expected, $this->subject->addData($input));
84  }
85 
90  {
91  $input = [
92  'command' => 'new',
93  'tableName' => 'pages',
94  'parentPageRow' => null,
95  ];
96  $expected = $input;
97  $expected['effectivePid'] = 0;
98  $this->assertSame($expected, $this->subject->addData($input));
99  }
100 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsUidOfParentPageRowIfParentPageRowExistsAndCommandIsNew
‪addDataSetsUidOfParentPageRowIfParentPageRowExistsAndCommandIsNew()
Definition: DatabaseEffectivePidTest.php:71
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsZeroWithMissingParentPageRowAndCommandIsNew
‪addDataSetsZeroWithMissingParentPageRowAndCommandIsNew()
Definition: DatabaseEffectivePidTest.php:88
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEffectivePid
Definition: DatabaseEffectivePid.php:23
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\setUp
‪setUp()
Definition: DatabaseEffectivePidTest.php:29
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsPidOfRecordIfNoPageIsEdited
‪addDataSetsPidOfRecordIfNoPageIsEdited()
Definition: DatabaseEffectivePidTest.php:54
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsUidOfRecordIsPageIsEdited
‪addDataSetsUidOfRecordIsPageIsEdited()
Definition: DatabaseEffectivePidTest.php:37
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest
Definition: DatabaseEffectivePidTest.php:24
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\$subject
‪DatabaseEffectivePid $subject
Definition: DatabaseEffectivePidTest.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:3