TYPO3 CMS  TYPO3_8-7
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 
22 class DatabaseEffectivePidTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
23 {
27  protected $subject;
28 
29  protected function setUp()
30  {
31  $this->subject = new DatabaseEffectivePid();
32  }
33 
38  {
39  $input = [
40  'command' => 'edit',
41  'tableName' => 'pages',
42  'databaseRow' => [
43  'uid' => 123,
44  ],
45  ];
46  $expected = $input;
47  $expected['effectivePid'] = 123;
48  $this->assertSame($expected, $this->subject->addData($input));
49  }
50 
55  {
56  $input = [
57  'command' => 'edit',
58  'tableName' => 'tt_content',
59  'databaseRow' => [
60  'pid' => 123,
61  ],
62  ];
63  $expected = $input;
64  $expected['effectivePid'] = 123;
65  $this->assertSame($expected, $this->subject->addData($input));
66  }
67 
72  {
73  $input = [
74  'command' => 'new',
75  'tableName' => 'tt_content',
76  'parentPageRow' => [
77  'uid' => 123
78  ],
79  ];
80  $expected = $input;
81  $expected['effectivePid'] = 123;
82  $this->assertSame($expected, $this->subject->addData($input));
83  }
84 
89  {
90  $input = [
91  'command' => 'new',
92  'tableName' => 'pages',
93  'parentPageRow' => null,
94  ];
95  $expected = $input;
96  $expected['effectivePid'] = 0;
97  $this->assertSame($expected, $this->subject->addData($input));
98  }
99 }