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