‪TYPO3CMS  ‪main
AbstractCoreMatcherTest.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;
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
24 final class ‪AbstractCoreMatcherTest extends UnitTestCase
25 {
26  #[Test]
28  {
29  $subject = new ‪AbstractCoreMatcherFixture();
30  $configuration = [
31  'foo/bar->baz' => [
32  'requiredArg1' => 42,
33  'restFiles' => [
34  'aRest.rst',
35  ],
36  ],
37  ];
38  $subject->matcherDefinitions = $configuration;
39  $subject->validateMatcherDefinitions(['requiredArg1']);
40  }
41 
42  #[Test]
44  {
45  $subject = new ‪AbstractCoreMatcherFixture();
46  $configuration = [
47  'foo/bar->baz' => [
48  'someNotRequiredConfig' => '',
49  'restFiles' => [
50  'aRest.rst',
51  ],
52  ],
53  ];
54  $subject->matcherDefinitions = $configuration;
55  $this->expectException(\InvalidArgumentException::class);
56  $this->expectExceptionCode(1500492001);
57  $subject->validateMatcherDefinitions(['requiredArg1']);
58  }
59 
60  #[Test]
62  {
63  $subject = new ‪AbstractCoreMatcherFixture();
64  $configuration = [
65  'foo/bar->baz' => [
66  'restFiles' => [],
67  ],
68  ];
69  $subject->matcherDefinitions = $configuration;
70  $this->expectException(\InvalidArgumentException::class);
71  $this->expectExceptionCode(1500496068);
72  $subject->validateMatcherDefinitions([]);
73  }
74 
75  #[Test]
77  {
78  $subject = new ‪AbstractCoreMatcherFixture();
79  $configuration = [
80  'foo/bar->baz' => [
81  'restFiles' => [
82  'foo.rst',
83  '',
84  ],
85  ],
86  ];
87  $subject->matcherDefinitions = $configuration;
88  $this->expectException(\InvalidArgumentException::class);
89  $this->expectExceptionCode(1500735983);
90  $subject->validateMatcherDefinitions([]);
91  }
92 
93  #[Test]
95  {
96  $subject = new ‪AbstractCoreMatcherFixture();
97  $configuration = [
98  'no\method\given' => [
99  'restFiles' => [],
100  ],
101  ];
102  $subject->matcherDefinitions = $configuration;
103  $this->expectException(\RuntimeException::class);
104  $this->expectExceptionCode(1500557309);
105  $subject->initializeFlatMatcherDefinitions();
106  }
107 }
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\AbstractCoreMatcherTest\validateMatcherDefinitionsThrowsWithEmptySingleRestFile
‪validateMatcherDefinitionsThrowsWithEmptySingleRestFile()
Definition: AbstractCoreMatcherTest.php:76
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\AbstractCoreMatcherTest\validateMatcherDefinitionsThrowsIfRequiredArgIsNotInConfig
‪validateMatcherDefinitionsThrowsIfRequiredArgIsNotInConfig()
Definition: AbstractCoreMatcherTest.php:43
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\AbstractCoreMatcherTest\initializeMethodNameArrayThrowsWithInvalidKeys
‪initializeMethodNameArrayThrowsWithInvalidKeys()
Definition: AbstractCoreMatcherTest.php:94
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\AbstractCoreMatcherTest
Definition: AbstractCoreMatcherTest.php:25
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher
Definition: AbstractCoreMatcherTest.php:18
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\AbstractCoreMatcherTest\validateMatcherDefinitionsRunsFineWithProperDefinition
‪validateMatcherDefinitionsRunsFineWithProperDefinition()
Definition: AbstractCoreMatcherTest.php:27
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\AbstractCoreMatcherTest\validateMatcherDefinitionsThrowsWithMissingRestFiles
‪validateMatcherDefinitionsThrowsWithMissingRestFiles()
Definition: AbstractCoreMatcherTest.php:61
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\Matcher\Fixtures\AbstractCoreMatcherFixture
Definition: AbstractCoreMatcherFixture.php:23