‪TYPO3CMS  ‪main
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 
20 use PHPUnit\Framework\Attributes\Test;
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
24 final class ‪DatabaseEffectivePidTest extends UnitTestCase
25 {
27 
28  protected function ‪setUp(): void
29  {
30  parent::setUp();
31  $this->subject = new ‪DatabaseEffectivePid();
32  }
33 
34  #[Test]
36  {
37  $input = [
38  'command' => 'edit',
39  'tableName' => 'pages',
40  'databaseRow' => [
41  'uid' => 123,
42  ],
43  ];
44  $expected = $input;
45  $expected['effectivePid'] = 123;
46  self::assertSame($expected, $this->subject->addData($input));
47  }
48 
49  #[Test]
51  {
52  $input = [
53  'command' => 'edit',
54  'tableName' => 'tt_content',
55  'databaseRow' => [
56  'pid' => 123,
57  ],
58  ];
59  $expected = $input;
60  $expected['effectivePid'] = 123;
61  self::assertSame($expected, $this->subject->addData($input));
62  }
63 
64  #[Test]
66  {
67  $input = [
68  'command' => 'new',
69  'tableName' => 'tt_content',
70  'parentPageRow' => [
71  'uid' => 123,
72  ],
73  ];
74  $expected = $input;
75  $expected['effectivePid'] = 123;
76  self::assertSame($expected, $this->subject->addData($input));
77  }
78 
79  #[Test]
81  {
82  $input = [
83  'command' => 'new',
84  'tableName' => 'pages',
85  'parentPageRow' => null,
86  ];
87  $expected = $input;
88  $expected['effectivePid'] = 0;
89  self::assertSame($expected, $this->subject->addData($input));
90  }
91 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsUidOfParentPageRowIfParentPageRowExistsAndCommandIsNew
‪addDataSetsUidOfParentPageRowIfParentPageRowExistsAndCommandIsNew()
Definition: DatabaseEffectivePidTest.php:65
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsZeroWithMissingParentPageRowAndCommandIsNew
‪addDataSetsZeroWithMissingParentPageRowAndCommandIsNew()
Definition: DatabaseEffectivePidTest.php:80
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseEffectivePid
Definition: DatabaseEffectivePid.php:24
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\setUp
‪setUp()
Definition: DatabaseEffectivePidTest.php:28
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsPidOfRecordIfNoPageIsEdited
‪addDataSetsPidOfRecordIfNoPageIsEdited()
Definition: DatabaseEffectivePidTest.php:50
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\addDataSetsUidOfRecordIsPageIsEdited
‪addDataSetsUidOfRecordIsPageIsEdited()
Definition: DatabaseEffectivePidTest.php:35
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest
Definition: DatabaseEffectivePidTest.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseEffectivePidTest\$subject
‪DatabaseEffectivePid $subject
Definition: DatabaseEffectivePidTest.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18