‪TYPO3CMS  10.4
DatabaseRecordOverrideValuesTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪DatabaseRecordOverrideValuesTest extends UnitTestCase
25 {
29  protected ‪$subject;
30 
31  protected function ‪setUp(): void
32  {
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()
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:65
‪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:38
‪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:25
‪TYPO3\CMS\Backend\Form\FormDataProvider\DatabaseRecordOverrideValues
Definition: DatabaseRecordOverrideValues.php:24