[BUGFIX] Notice free FormEngine testing
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / Form / FormDataProvider / TcaColumnsProcessRecordTitleTest.php
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\Backend\Form\FormDataProvider\TcaColumnsProcessRecordTitle;
18 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
19
20 /**
21 * Test case
22 */
23 class TcaColumnsProcessRecordTitleTest extends UnitTestCase
24 {
25 /**
26 * @test
27 */
28 public function addDataRegistersLabelColumn()
29 {
30 $input = [
31 'columnsToProcess' => [],
32 'isInlineChild' => false,
33 'processedTca' => [
34 'ctrl' => [
35 'label' => 'uid'
36 ],
37 'columns' => [],
38 ]
39 ];
40
41 $expected = $input;
42 $expected['columnsToProcess'] = ['uid'];
43 $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
44 }
45
46 /**
47 * @test
48 */
49 public function addDataRegistersAlternativeLabelColumnn()
50 {
51 $input = [
52 'columnsToProcess' => [],
53 'isInlineChild' => false,
54 'processedTca' => [
55 'ctrl' => [
56 'label' => 'uid',
57 'label_alt' => 'aField,anotherField',
58 ],
59 'columns' => [],
60 ]
61 ];
62
63 $expected = $input;
64 $expected['columnsToProcess'] = ['uid', 'aField', 'anotherField'];
65 $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
66 }
67
68 /**
69 * @test
70 */
71 public function addDataRegistersForeignLabelInInlineContext()
72 {
73 $input = [
74 'columnsToProcess' => [],
75 'inlineParentConfig' => [
76 'foreign_label' => 'aForeignLabelField',
77 ],
78 'isInlineChild' => true,
79 ];
80
81 $expected = $input;
82 $expected['columnsToProcess'] = [ 'aForeignLabelField' ];
83 $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
84 }
85
86 /**
87 * @test
88 */
89 public function addDataRegistersSymmetricLabelInInlineContext()
90 {
91 $input = [
92 'columnsToProcess' => [],
93 'inlineParentConfig' => [
94 'symmetric_label' => 'aSymmetricLabelField',
95 ],
96 'isInlineChild' => true,
97 ];
98
99 $expected = $input;
100 $expected['columnsToProcess'] = [ 'aSymmetricLabelField' ];
101 $this->assertSame($expected, (new TcaColumnsProcessRecordTitle)->addData($input));
102 }
103 }