|
11 | 11 | use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory; |
12 | 12 | use Ibexa\CodeStyle\PhpCsFixer\Sets\Ibexa46RuleSet; |
13 | 13 | use Ibexa\CodeStyle\PhpCsFixer\Sets\Ibexa50RuleSet; |
| 14 | +use PhpCsFixer\ParallelAwareConfigInterface; |
14 | 15 | use PHPUnit\Framework\TestCase; |
15 | 16 | use ReflectionClass; |
16 | 17 | use ReflectionMethod; |
@@ -40,6 +41,8 @@ protected function setUp(): void |
40 | 41 | * |
41 | 42 | * @param array{name: string, version: string, pretty_version?: string} $package |
42 | 43 | * @param class-string $expectedRuleSetClass |
| 44 | + * |
| 45 | + * @throws \ReflectionException |
43 | 46 | */ |
44 | 47 | public function testVersionBasedRuleSetSelection( |
45 | 48 | array $package, |
@@ -98,4 +101,25 @@ public function testWithRuleSet(): void |
98 | 101 |
|
99 | 102 | self::assertSame($customRuleSet, $this->factory->getRuleSet()); |
100 | 103 | } |
| 104 | + |
| 105 | + public function testRunInParallel(): void |
| 106 | + { |
| 107 | + // Note: sequential test instead of separate test cases on purpose |
| 108 | + |
| 109 | + // sanity check |
| 110 | + /** @var ParallelAwareConfigInterface $config */ |
| 111 | + $config = $this->factory->buildConfig(); |
| 112 | + self::assertSame(1, $config->getParallelConfig()->getMaxProcesses()); |
| 113 | + |
| 114 | + $this->factory->runInParallel(); |
| 115 | + /** @var ParallelAwareConfigInterface $config */ |
| 116 | + $config = $this->factory->buildConfig(); |
| 117 | + self::assertGreaterThan(1, $config->getParallelConfig()->getMaxProcesses()); |
| 118 | + |
| 119 | + // reset test |
| 120 | + $this->factory->runInParallel(false); |
| 121 | + /** @var ParallelAwareConfigInterface $config */ |
| 122 | + $config = $this->factory->buildConfig(); |
| 123 | + self::assertSame(1, $config->getParallelConfig()->getMaxProcesses()); |
| 124 | + } |
101 | 125 | } |
0 commit comments