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