3df172a79bb63061e789fe5ad64c08ee3e7dfccb
[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
19 /**
20 * Test case
21 */
22 class TcaColumnsProcessRecordTitleTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
23 {
24 /**
25 * Subject is not notice free, disable E_NOTICES
26 */
27 protected static $suppressNotices = true;
28
29 /**
30 * @var TcaColumnsProcessRecordTitle
31 */
32 protected $subject;
33
34 protected function setUp()
35 {
36 $this->subject = new TcaColumnsProcessRecordTitle();
37 }
38
39 /**
40 * @test
41 */
42 public function addDataRegistersLabelColumn()
43 {
44 $input = [
45 'columnsToProcess' => [],
46 'processedTca' => [
47 'ctrl' => [
48 'label' => 'uid'
49 ],
50 'columns' => [],
51 ]
52 ];
53
54 $expected = $input;
55 $expected['columnsToProcess'] = ['uid'];
56 $this->assertSame($expected, $this->subject->addData($input));
57 }
58
59 /**
60 * @test
61 */
62 public function addDataRegistersAlternativeLabelColumnn()
63 {
64 $input = [
65 'columnsToProcess' => [],
66 'processedTca' => [
67 'ctrl' => [
68 'label' => 'uid',
69 'label_alt' => 'aField,anotherField',
70 ],
71 'columns' => [],
72 ]
73 ];
74
75 $expected = $input;
76 $expected['columnsToProcess'] = ['uid', 'aField', 'anotherField'];
77 $this->assertSame($expected, $this->subject->addData($input));
78 }
79
80 /**
81 * @test
82 */
83 public function addDataRegistersForeignLabelInInlineContext()
84 {
85 $input = [
86 'columnsToProcess' => [],
87 'inlineParentConfig' => [
88 'foreign_label' => 'aForeignLabelField',
89 ],
90 'isInlineChild' => true,
91 ];
92
93 $expected = $input;
94 $expected['columnsToProcess'] = [ 'aForeignLabelField' ];
95 $this->assertSame($expected, $this->subject->addData($input));
96 }
97
98 /**
99 * @test
100 */
101 public function addDataRegistersSymmetricLabelInInlineContext()
102 {
103 $input = [
104 'columnsToProcess' => [],
105 'inlineParentConfig' => [
106 'symmetric_label' => 'aSymmetricLabelField',
107 ],
108 'isInlineChild' => true,
109 ];
110
111 $expected = $input;
112 $expected['columnsToProcess'] = [ 'aSymmetricLabelField' ];
113 $this->assertSame($expected, $this->subject->addData($input));
114 }
115 }