‪TYPO3CMS  11.5
InitializeProcessedTcaTest.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 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
26 class ‪InitializeProcessedTcaTest extends UnitTestCase
27 {
29 
30  protected function ‪setUp(): void
31  {
32  parent::setUp();
33  $this->subject = new ‪InitializeProcessedTca();
34  }
35 
40  {
41  $input = [
42  'tableName' => 'aTable',
43  ];
44  $expected = [
45  'columns' => [],
46  ];
47  ‪$GLOBALS['TCA'][$input['tableName']] = $expected;
48  $result = $this->subject->addData($input);
49  self::assertEquals($expected, $result['processedTca']);
50  }
51 
55  public function ‪addDataKeepsGivenProcessedTca(): void
56  {
57  $input = [
58  'tableName' => 'aTable',
59  'processedTca' => [
60  'columns' => [
61  'afield' => [],
62  ],
63  ],
64  ];
65  $expected = $input;
66  self::assertEquals($expected, $this->subject->addData($input));
67  }
68 
73  {
74  $input = [
75  'tableName' => 'aTable',
76  ];
77 
78  $this->expectException(\UnexpectedValueException::class);
79  $this->expectExceptionCode(1437914223);
80 
81  $this->subject->addData($input);
82  }
83 
88  {
89  $input = [
90  'tableName' => 'aTable',
91  ];
92  ‪$GLOBALS['TCA'][$input['tableName']] = 'foo';
93  $this->expectException(\UnexpectedValueException::class);
94  $this->expectExceptionCode(1437914223);
95 
96  $this->subject->addData($input);
97  }
98 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\InitializeProcessedTca
Definition: InitializeProcessedTca.php:24
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest
Definition: InitializeProcessedTcaTest.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest\$subject
‪InitializeProcessedTca $subject
Definition: InitializeProcessedTcaTest.php:28
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest\addDataSetsTableTcaFromGlobalsInResult
‪addDataSetsTableTcaFromGlobalsInResult()
Definition: InitializeProcessedTcaTest.php:39
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest\addDataKeepsGivenProcessedTca
‪addDataKeepsGivenProcessedTca()
Definition: InitializeProcessedTcaTest.php:55
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest\addDataThrowsExceptionIfGlobalTableTcaIsNotAnArray
‪addDataThrowsExceptionIfGlobalTableTcaIsNotAnArray()
Definition: InitializeProcessedTcaTest.php:87
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest\addDataThrowsExceptionIfGlobalTableTcaIsNotSet
‪addDataThrowsExceptionIfGlobalTableTcaIsNotSet()
Definition: InitializeProcessedTcaTest.php:72
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest\setUp
‪setUp()
Definition: InitializeProcessedTcaTest.php:30
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider
Definition: DatabaseDefaultLanguagePageRowTest.php:18