Skip to content

Commit d97df69

Browse files
committed
[Tests] Added coverage for configuring parallel run
1 parent 844a2fb commit d97df69

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/lib/PhpCsFixer/InternalConfigFactoryTest.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Ibexa\CodeStyle\PhpCsFixer\InternalConfigFactory;
1212
use Ibexa\CodeStyle\PhpCsFixer\Sets\Ibexa46RuleSet;
1313
use Ibexa\CodeStyle\PhpCsFixer\Sets\Ibexa50RuleSet;
14+
use PhpCsFixer\ParallelAwareConfigInterface;
1415
use PHPUnit\Framework\TestCase;
1516
use ReflectionClass;
1617
use ReflectionMethod;
@@ -40,6 +41,8 @@ protected function setUp(): void
4041
*
4142
* @param array{name: string, version: string, pretty_version?: string} $package
4243
* @param class-string $expectedRuleSetClass
44+
*
45+
* @throws \ReflectionException
4346
*/
4447
public function testVersionBasedRuleSetSelection(
4548
array $package,
@@ -98,4 +101,25 @@ public function testWithRuleSet(): void
98101

99102
self::assertSame($customRuleSet, $this->factory->getRuleSet());
100103
}
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+
}
101125
}

0 commit comments

Comments
 (0)