‪TYPO3CMS  ‪main
TcaColumnsProcessPlaceholdersTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
20 use PHPUnit\Framework\Attributes\Test;
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
24 final class ‪TcaColumnsProcessPlaceholdersTest extends UnitTestCase
25 {
27 
28  protected function ‪setUp(): void
29  {
30  parent::setUp();
31  $this->subject = new ‪TcaColumnsProcessPlaceholders();
32  }
33 
34  #[Test]
35  public function ‪addDataRegistersPlaceholderColumns(): void
36  {
37  $input = [
38  'columnsToProcess' => [],
39  'processedTca' => [
40  'columns' => [
41  'aField' => [
42  'config' => [
43  'type' => 'input',
44  'placeholder' => '__row|anotherField',
45  ],
46  ],
47  ],
48  ],
49  ];
50 
51  $expected = $input;
52  $expected['columnsToProcess'] = ['anotherField'];
53  self::assertSame($expected, $this->subject->addData($input));
54  }
55 
56  #[Test]
58  {
59  $input = [
60  'columnsToProcess' => [],
61  'processedTca' => [
62  'columns' => [
63  'aField' => [
64  'config' => [
65  'type' => 'input',
66  'placeholder' => '__row|uid_local|metadata|title',
67  ],
68  ],
69  ],
70  ],
71  ];
72 
73  $expected = $input;
74  $expected['columnsToProcess'] = ['uid_local'];
75  self::assertSame($expected, $this->subject->addData($input));
76  }
77 
78  #[Test]
80  {
81  $input = [
82  'columnsToProcess' => [],
83  'processedTca' => [
84  'columns' => [
85  'aField' => [
86  'config' => [
87  'type' => 'input',
88  'placeholder' => 'A simple placeholder',
89  ],
90  ],
91  ],
92  ],
93  ];
94 
95  $expected = $input;
96  self::assertSame($expected, $this->subject->addData($input));
97  }
98 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessPlaceholdersTest\addDataRegistersAlternativeLabelColumn
‪addDataRegistersAlternativeLabelColumn()
Definition: TcaColumnsProcessPlaceholdersTest.php:79
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessPlaceholdersTest\addDataRegistersPlaceholderColumns
‪addDataRegistersPlaceholderColumns()
Definition: TcaColumnsProcessPlaceholdersTest.php:35
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessPlaceholdersTest
Definition: TcaColumnsProcessPlaceholdersTest.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessPlaceholdersTest\$subject
‪TcaColumnsProcessPlaceholders $subject
Definition: TcaColumnsProcessPlaceholdersTest.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessPlaceholdersTest\addDataRegistersFirstPlaceholderColumn
‪addDataRegistersFirstPlaceholderColumn()
Definition: TcaColumnsProcessPlaceholdersTest.php:57
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsProcessPlaceholdersTest\setUp
‪setUp()
Definition: TcaColumnsProcessPlaceholdersTest.php:28
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsProcessPlaceholders
Definition: TcaColumnsProcessPlaceholders.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18