‪TYPO3CMS  11.5
DatabaseRecordOverrideValuesTest.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 ‪DatabaseRecordOverrideValuesTest extends UnitTestCase
27 {
29 
30  protected function ‪setUp(): void
31  {
32  parent::setUp();
33  $this->subject = new ‪DatabaseRecordOverrideValues();
34  }
35 
40  {
41  $input = [
42  'tableName' => 'aTable',
43  'processedTca' => [
44  'columns' => [
45  'aField' => [
46  'config' => [
47  'type' => 'input',
48  ],
49  ],
50  ],
51  ],
52  'databaseRow' => [
53  'uid' => 42,
54  ],
55  'overrideValues' => [
56  'anotherField' => 13,
57  ],
58  ];
59 
60  self::assertSame($input, $this->subject->addData($input));
61  }
62 
66  public function ‪addDataSetsDatabaseRowAndTcaType(): void
67  {
68  $input = [
69  'tableName' => 'aTable',
70  'processedTca' => [
71  'columns' => [
72  'aField' => [
73  'config' => [
74  'type' => 'input',
75  ],
76  ],
77  'anotherField' => [
78  'config' => [
79  'type' => 'input',
80  ],
81  ],
82  ],
83  ],
84  'databaseRow' => [
85  'uid' => 42,
86  ],
87  'overrideValues' => [
88  'aField' => 256,
89  'anotherField' => 13,
90  ],
91  ];
92 
93  $expected = $input;
94  $expected['databaseRow']['aField'] = 256;
95  $expected['databaseRow']['anotherField'] = 13;
96  $expected['processedTca']['columns']['aField']['config'] = [
97  'type' => 'hidden',
98  'renderType' => 'hidden',
99  ];
100  $expected['processedTca']['columns']['anotherField']['config'] = [
101  'type' => 'hidden',
102  'renderType' => 'hidden',
103  ];
104 
105  self::assertSame($expected, $this->subject->addData($input));
106  }
107 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseRecordOverrideValuesTest\addDataSetsDatabaseRowAndTcaType
‪addDataSetsDatabaseRowAndTcaType()
Definition: DatabaseRecordOverrideValuesTest.php:66
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseRecordOverrideValuesTest\setUp
‪setUp()
Definition: DatabaseRecordOverrideValuesTest.php:30
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseRecordOverrideValuesTest\addDataReturnSameDataIfNoOverrideValuesSet
‪addDataReturnSameDataIfNoOverrideValuesSet()
Definition: DatabaseRecordOverrideValuesTest.php:39
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseRecordOverrideValuesTest\$subject
‪DatabaseRecordOverrideValues $subject
Definition: DatabaseRecordOverrideValuesTest.php:28
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\DatabaseRecordOverrideValuesTest
Definition: DatabaseRecordOverrideValuesTest.php:27
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRecordOverrideValues
Definition: DatabaseRecordOverrideValues.php:24