‪TYPO3CMS  11.5
ExtensionUtilityTest.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 
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
27 class ‪ExtensionUtilityTest extends UnitTestCase
28 {
29  protected function ‪setUp(): void
30  {
31  parent::setUp();
32  ‪$GLOBALS['TSFE'] = new \stdClass();
33  ‪$GLOBALS['TSFE']->tmpl = new \stdClass();
34  ‪$GLOBALS['TSFE']->tmpl->setup = [];
35  ‪$GLOBALS['TSFE']->tmpl->setup['tt_content.']['list.']['20.'] = [
36  '9' => 'CASE',
37  '9.' => [
38  'key.' => [
39  'field' => 'layout',
40  ],
41  0 => '< plugin.tt_news',
42  ],
43  'extensionname_someplugin' => 'USER',
44  'extensionname_someplugin.' => [
45  'userFunc' => Bootstrap::class . '->run',
46  'extensionName' => 'ExtensionName',
47  'pluginName' => 'SomePlugin',
48  ],
49  'someotherextensionname_secondplugin' => 'USER',
50  'someotherextensionname_secondplugin.' => [
51  'userFunc' => Bootstrap::class . '->run',
52  'extensionName' => 'SomeOtherExtensionName',
53  'pluginName' => 'SecondPlugin',
54  ],
55  'extensionname_thirdplugin' => 'USER',
56  'extensionname_thirdplugin.' => [
57  'userFunc' => Bootstrap::class . '->run',
58  'extensionName' => 'ExtensionName',
59  'pluginName' => 'ThirdPlugin',
60  ],
61  ];
62  }
63 
69  {
70  ‪$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup.'] = [];
71  ‪ExtensionUtility::configurePlugin('MyExtension', 'Pi1', ['Blog' => 'index']);
72  $staticTypoScript = ‪$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup.']['defaultContentRendering'];
73  self::assertStringContainsString('tt_content.list.20.myextension_pi1 = USER', $staticTypoScript);
74  self::assertStringContainsString('
75  userFunc = TYPO3\\CMS\\Extbase\\Core\\Bootstrap->run
76  extensionName = MyExtension
77  pluginName = Pi1', $staticTypoScript);
78  self::assertStringNotContainsString('USER_INT', $staticTypoScript);
79  }
80 
86  {
87  ‪$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup.'] = [];
88  ‪ExtensionUtility::configurePlugin('MyExtension', 'Pi1', ['Blog' => 'index']);
89  $staticTypoScript = ‪$GLOBALS['TYPO3_CONF_VARS']['FE']['defaultTypoScript_setup.']['defaultContentRendering'];
90  self::assertStringContainsString('tt_content.list.20.myextension_pi1 = USER', $staticTypoScript);
91  }
92 
97  {
98  ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'] = [];
100  'TYPO3.CMS.IndexedSearch',
101  'Pi2',
102  'Testing'
103  );
104  self::assertSame(
105  'indexedsearch_pi2',
106  ‪$GLOBALS['TCA']['tt_content']['columns']['list_type']['config']['items'][0][1]
107  );
108  }
109 }
‪TYPO3\CMS\Extbase\Utility\ExtensionUtility\registerPlugin
‪static registerPlugin($extensionName, $pluginName, $pluginTitle, $pluginIcon=null, $group='default')
Definition: ExtensionUtility.php:139
‪TYPO3\CMS\Extbase\Utility\ExtensionUtility
Definition: ExtensionUtility.php:29
‪TYPO3\CMS\Extbase\Utility\ExtensionUtility\configurePlugin
‪static configurePlugin($extensionName, $pluginName, array $controllerActions, array $nonCacheableControllerActions=[], $pluginType=self::PLUGIN_TYPE_PLUGIN)
Definition: ExtensionUtility.php:50
‪TYPO3\CMS\Extbase\Tests\UnitDeprecated\Utility
Definition: ExtensionUtilityTest.php:18
‪TYPO3\CMS\Extbase\Tests\UnitDeprecated\Utility\ExtensionUtilityTest\setUp
‪setUp()
Definition: ExtensionUtilityTest.php:29
‪TYPO3\CMS\Extbase\Tests\UnitDeprecated\Utility\ExtensionUtilityTest\configurePluginWorksForMinimalisticSetup
‪configurePluginWorksForMinimalisticSetup()
Definition: ExtensionUtilityTest.php:68
‪TYPO3\CMS\Extbase\Tests\UnitDeprecated\Utility\ExtensionUtilityTest\configurePluginCreatesCorrectDefaultTypoScriptSetup
‪configurePluginCreatesCorrectDefaultTypoScriptSetup()
Definition: ExtensionUtilityTest.php:85
‪TYPO3\CMS\Extbase\Tests\UnitDeprecated\Utility\ExtensionUtilityTest\registerPluginRegistersPluginWithDeprecatedVendorInExtensionName
‪registerPluginRegistersPluginWithDeprecatedVendorInExtensionName()
Definition: ExtensionUtilityTest.php:96
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Extbase\Core\Bootstrap
Definition: Bootstrap.php:42
‪TYPO3\CMS\Extbase\Tests\UnitDeprecated\Utility\ExtensionUtilityTest
Definition: ExtensionUtilityTest.php:28