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