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