‪TYPO3CMS  10.4
EmConfUtilityTest.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 
18 use TYPO3\CMS\Extensionmanager\Utility\EmConfUtility;
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪EmConfUtilityTest extends UnitTestCase
25 {
26 
31  {
32  $extensionData = [
33  'extKey' => 'key',
34  'EM_CONF' => [],
35  ];
36  $subject = new EmConfUtility();
37  $emConf = $subject->constructEmConf($extensionData);
38  self::assertStringContainsString('Extension Manager/Repository config file for ext', $emConf);
39  }
40 
45  {
46  $input = [
47  'title' => 'a title',
48  'conflicts' => 'foo',
49  ];
50  $expected = [
51  'title' => 'a title',
52  'constraints' => [
53  'depends' => [],
54  'conflicts' => [
55  'foo' => '',
56  ],
57  'suggests' => [],
58  ],
59  ];
60  $subject = new EmConfUtility();
61  $_EXTKEY = 'seminars';
62  $result = $subject->constructEmConf(['EM_CONF' => $input, 'extKey' => $_EXTKEY]);
63  eval(substr($result, 7));
64  $result = ‪$EM_CONF[$_EXTKEY];
65  self::assertEquals($expected, $result);
66  }
67 
72  {
73  $input = [
74  'title' => 'a title',
75  'conflicts' => 'foo,bar',
76  ];
77  $expected = [
78  'title' => 'a title',
79  'constraints' => [
80  'depends' => [],
81  'conflicts' => [
82  'foo' => '',
83  'bar' => '',
84  ],
85  'suggests' => [],
86  ],
87  ];
88  $subject = new EmConfUtility();
89 
90  $_EXTKEY = 'seminars';
91  $result = $subject->constructEmConf(['EM_CONF' => $input, 'extKey' => $_EXTKEY]);
92  eval(substr($result, 7));
93  $result = ‪$EM_CONF[$_EXTKEY];
94  self::assertEquals($expected, $result);
95  }
96 }
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\EmConfUtilityTest
Definition: EmConfUtilityTest.php:25
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility
Definition: DependencyUtilityTest.php:16
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\EmConfUtilityTest\constructEmConfAddsCommentBlock
‪constructEmConfAddsCommentBlock()
Definition: EmConfUtilityTest.php:30
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\EmConfUtilityTest\fixEmConfTransfersOldConflictSettingToNewFormatWithSingleConflictingExtension
‪fixEmConfTransfersOldConflictSettingToNewFormatWithSingleConflictingExtension()
Definition: EmConfUtilityTest.php:44
‪TYPO3\CMS\Extensionmanager\Tests\Unit\Utility\EmConfUtilityTest\fixEmConfTransfersOldConflictSettingToNewFormatWithTwoConflictingExtensions
‪fixEmConfTransfersOldConflictSettingToNewFormatWithTwoConflictingExtensions()
Definition: EmConfUtilityTest.php:71
‪$EM_CONF
‪$EM_CONF[$_EXTKEY]
Definition: ext_emconf.php:3