‪TYPO3CMS  ‪main
TcaColumnsRemoveUnusedTest.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 ‪TcaColumnsRemoveUnusedTest extends UnitTestCase
25 {
27 
28  protected function ‪setUp(): void
29  {
30  parent::setUp();
31  $this->subject = new ‪TcaColumnsRemoveUnused();
32  }
33 
34  #[Test]
35  public function ‪addDataKeepsColumnsToProcess(): void
36  {
37  $input = [
38  'columnsToProcess' => ['keepMe', 'keepMeToo'],
39  'processedTca' => [
40  'columns' => [
41  'keepMe' => [
42  'config' => [
43  'type' => 'input',
44  ],
45  ],
46  'keepMeToo' => [
47  'config' => [
48  'type' => 'input',
49  ],
50  ],
51  'aField' => [
52  'config' => [
53  'type' => 'input',
54  ],
55  ],
56  ],
57  ],
58  ];
59 
60  $expected = $input;
61  unset($expected['processedTca']['columns']['aField']);
62 
63  self::assertSame($expected, $this->subject->addData($input));
64  }
65 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsRemoveUnusedTest\$subject
‪TcaColumnsRemoveUnused $subject
Definition: TcaColumnsRemoveUnusedTest.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsRemoveUnusedTest\setUp
‪setUp()
Definition: TcaColumnsRemoveUnusedTest.php:28
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsRemoveUnusedTest\addDataKeepsColumnsToProcess
‪addDataKeepsColumnsToProcess()
Definition: TcaColumnsRemoveUnusedTest.php:35
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\TcaColumnsRemoveUnusedTest
Definition: TcaColumnsRemoveUnusedTest.php:25
‪TYPO3\CMS\Backend\Form\FormDataProvider\TcaColumnsRemoveUnused
Definition: TcaColumnsRemoveUnused.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18