‪TYPO3CMS  ‪main
MatcherFactoryTest.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 ‪MatcherFactoryTest extends UnitTestCase
25 {
26  #[Test]
27  public function ‪createAllThrowWithMissingClass(): void
28  {
29  $subject = new ‪MatcherFactory();
30  $this->expectException(\RuntimeException::class);
31  $this->expectExceptionCode(1501415721);
32  $configuration = [
33  [
34  'configurationFile' => 'foo',
35  ],
36  ];
37  $subject->createAll($configuration);
38  }
39 
40  #[Test]
42  {
43  $subject = new ‪MatcherFactory();
44  $this->expectException(\RuntimeException::class);
45  $this->expectExceptionCode(1501416365);
46  $configuration = [
47  [
48  'class' => \stdClass::class,
49  ],
50  ];
51  $subject->createAll($configuration);
52  }
53 
54  #[Test]
56  {
57  $subject = new ‪MatcherFactory();
58  $this->expectException(\RuntimeException::class);
59  $this->expectExceptionCode(1501419367);
60  $configuration = [
61  [
62  'class' => \stdClass::class,
63  'configurationFile' => 'foo',
64  'configurationArray' => [],
65  ],
66  ];
67  $subject->createAll($configuration);
68  }
69 
70  #[Test]
72  {
73  $subject = new ‪MatcherFactory();
74  $this->expectException(\RuntimeException::class);
75  $this->expectExceptionCode(1501509605);
76  $configuration = [
77  [
78  'class' => \stdClass::class,
79  'configurationFile' => 'EXT:install/does/not/exist.php',
80  ],
81  ];
82  $subject->createAll($configuration);
83  }
84 
85  #[Test]
87  {
88  $subject = new ‪MatcherFactory();
89  $this->expectException(\RuntimeException::class);
90  $this->expectExceptionCode(1501509548);
91  $configuration = [
92  [
93  'class' => \stdClass::class,
94  'configurationFile' => 'EXT:install/Tests/Unit/ExtensionScanner/Php/Fixtures/MatcherFactoryInvalidConfigurationFileFixture.php',
95  ],
96  ];
97  $subject->createAll($configuration);
98  }
99 
100  #[Test]
102  {
103  $subject = new ‪MatcherFactory();
104  $this->expectException(\RuntimeException::class);
105  $this->expectExceptionCode(1501509738);
106  $configuration = [
107  [
108  'class' => \stdClass::class,
109  'configurationArray' => 'foo',
110  ],
111  ];
112  $subject->createAll($configuration);
113  }
114 
115  #[Test]
117  {
118  $subject = new ‪MatcherFactory();
119  $this->expectException(\RuntimeException::class);
120  $this->expectExceptionCode(1501510168);
121  $configuration = [
122  [
123  'class' => \stdClass::class,
124  'configurationArray' => [],
125  ],
126  ];
127  $subject->createAll($configuration);
128  }
129 }
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest\createAllThrowsWithMissingConfiguration
‪createAllThrowsWithMissingConfiguration()
Definition: MatcherFactoryTest.php:41
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest
Definition: MatcherFactoryTest.php:25
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest\createAllThrowsWithBothConfigurationFileAndConfigurationArray
‪createAllThrowsWithBothConfigurationFileAndConfigurationArray()
Definition: MatcherFactoryTest.php:55
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php
Definition: CodeStatisticsTest.php:18
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest\createAllThrowsIfConfigurationFileDoesNotExist
‪createAllThrowsIfConfigurationFileDoesNotExist()
Definition: MatcherFactoryTest.php:71
‪TYPO3\CMS\Install\ExtensionScanner\Php\MatcherFactory
Definition: MatcherFactory.php:29
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest\createAllThrowsIfConfigurationFileDoesNotReturnArray
‪createAllThrowsIfConfigurationFileDoesNotReturnArray()
Definition: MatcherFactoryTest.php:86
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest\createAllThrowsIfConfigurationArrayIsNotAnArray
‪createAllThrowsIfConfigurationArrayIsNotAnArray()
Definition: MatcherFactoryTest.php:101
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest\createAllThrowWithMissingClass
‪createAllThrowWithMissingClass()
Definition: MatcherFactoryTest.php:27
‪TYPO3\CMS\Install\Tests\Unit\ExtensionScanner\Php\MatcherFactoryTest\createAllThrowIfMatcherDoesNotImplementCodeScannerInterface
‪createAllThrowIfMatcherDoesNotImplementCodeScannerInterface()
Definition: MatcherFactoryTest.php:116