[TASK] Order use statements alphabetically
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / Form / FormDataProvider / TcaColumnsProcessPlaceholdersTest.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\TcaColumnsProcessPlaceholders;
18 use TYPO3\CMS\Core\Tests\UnitTestCase;
19
20 /**
21 * Test case
22 */
23 class TcaColumnsProcessPlaceholdersTest extends UnitTestCase
24 {
25 /**
26 * @var TcaColumnsProcessPlaceholders
27 */
28 protected $subject;
29
30 protected function setUp()
31 {
32 $this->subject = new TcaColumnsProcessPlaceholders();
33 }
34
35 /**
36 * @test
37 */
38 public function addDataRegistersPlaceholderColumns()
39 {
40 $input = [
41 'columnsToProcess' => [],
42 'processedTca' => [
43 'columns' => [
44 'aField' => [
45 'config' => [
46 'type' => 'input',
47 'placeholder' => '__row|anotherField'
48 ],
49 ],
50 ],
51 ]
52 ];
53
54 $expected = $input;
55 $expected['columnsToProcess'] = ['anotherField'];
56 $this->assertSame($expected, $this->subject->addData($input));
57 }
58
59 /**
60 * @test
61 */
62 public function addDataRegistersFirstPlaceholderColumn()
63 {
64 $input = [
65 'columnsToProcess' => [],
66 'processedTca' => [
67 'columns' => [
68 'aField' => [
69 'config' => [
70 'type' => 'input',
71 'placeholder' => '__row|uid_local|metadata|title'
72 ],
73 ],
74 ],
75 ]
76 ];
77
78 $expected = $input;
79 $expected['columnsToProcess'] = ['uid_local'];
80 $this->assertSame($expected, $this->subject->addData($input));
81 }
82
83 /**
84 * @test
85 */
86 public function addDataRegistersAlternativeLabelColumnn()
87 {
88 $input = [
89 'columnsToProcess' => [],
90 'processedTca' => [
91 'columns' => [
92 'aField' => [
93 'config' => [
94 'type' => 'input',
95 'placeholder' => 'A simple placeholder'
96 ],
97 ],
98 ],
99 ]
100 ];
101
102 $expected = $input;
103 $this->assertSame($expected, $this->subject->addData($input));
104 }
105 }