TYPO3  7.6
TcaColumnsOverridesTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
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 
17 use TYPO3\CMS\Core\Tests\UnitTestCase;
19 
23 class TcaColumnsOverridesTest extends UnitTestCase
24 {
28  protected $subject;
29 
30  protected function setUp()
31  {
32  $this->subject = new TcaColumnsOverrides();
33  }
34 
39  {
40  $input = [
41  'recordTypeValue' => 'foo',
42  'processedTca' => [
43  'columns' => [],
44  'types' => [
45  'foo' => [
46  'showitem' => [],
47  'columnsOverrides' => [],
48  ],
49  ],
50  ],
51  ];
52 
53  $expected = $input;
54  unset($expected['processedTca']['types']['foo']['columnsOverrides']);
55 
56  $this->assertEquals($expected, $this->subject->addData($input));
57  }
58 
63  {
64  $input = [
65  'recordTypeValue' => 'foo',
66  'processedTca' => [
67  'columns' => [
68  'aField' => [
69  'aConfig' => 'aValue',
70  'anotherConfig' => 'anotherValue',
71  ],
72  ],
73  'types' => [
74  'foo' => [
75  'showitem' => [],
76  'columnsOverrides' => [
77  'aField' => [
78  'aConfig' => 'aDifferentValue',
79  ],
80  ],
81  ],
82  ],
83  ],
84  ];
85 
86  $expected = $input;
87  $expected['processedTca']['columns']['aField']['aConfig'] = 'aDifferentValue';
88  unset($expected['processedTca']['types']['foo']['columnsOverrides']);
89 
90  $this->assertEquals($expected, $this->subject->addData($input));
91  }
92 }