‪TYPO3CMS  10.4
InitializeProcessedTcaTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪InitializeProcessedTcaTest extends UnitTestCase
25 {
29  protected ‪$subject;
30 
31  protected function ‪setUp(): void
32  {
33  parent::setUp();
34  $this->subject = new ‪InitializeProcessedTca();
35  }
36 
41  {
42  $input = [
43  'tableName' => 'aTable',
44  ];
45  $expected = [
46  'columns' => []
47  ];
48  ‪$GLOBALS['TCA'][$input['tableName']] = $expected;
49  $result = $this->subject->addData($input);
50  self::assertEquals($expected, $result['processedTca']);
51  }
52 
56  public function ‪addDataKeepsGivenProcessedTca()
57  {
58  $input = [
59  'tableName' => 'aTable',
60  'processedTca' => [
61  'columns' => [
62  'afield' => [],
63  ],
64  ],
65  ];
66  $expected = $input;
67  self::assertEquals($expected, $this->subject->addData($input));
68  }
69 
74  {
75  $input = [
76  'tableName' => 'aTable',
77  ];
78 
79  $this->expectException(\UnexpectedValueException::class);
80  $this->expectExceptionCode(1437914223);
81 
82  $this->subject->addData($input);
83  }
84 
89  {
90  $input = [
91  'tableName' => 'aTable',
92  ];
93  ‪$GLOBALS['TCA'][$input['tableName']] = 'foo';
94  $this->expectException(\UnexpectedValueException::class);
95  $this->expectExceptionCode(1437914223);
96 
97  $this->subject->addData($input);
98  }
99 }
‪TYPO3\CMS\Backend\Form\FormDataProvider\InitializeProcessedTca
Definition: InitializeProcessedTca.php:24
‪TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider\InitializeProcessedTcaTest
Definition: InitializeProcessedTcaTest.php:25
‪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:5
‪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