Skip to content

Commit b4c01ed

Browse files
committed
Fixing a troublesome test on Windows
1 parent 46937d3 commit b4c01ed

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

src/Test/MakerTestCase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ protected function executeMakerCommand(MakerTestDetails $testDetails)
5454
$this->markTestSkipped();
5555
}
5656

57+
if ($testDetails->skipOnWindows() && '\\' === \DIRECTORY_SEPARATOR) {
58+
$this->markTestSkipped('This test is not supported on Windows');
59+
}
60+
5761
$testEnv = MakerTestEnvironment::create($testDetails);
5862

5963
// prepare environment to test

src/Test/MakerTestDetails.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ final class MakerTestDetails
2424
private array $requiredPackageVersions = [];
2525
private int $blockedPhpVersionUpper = 0;
2626
private int $blockedPhpVersionLower = 0;
27+
private bool $skipOnWindows = false;
2728

2829
public function __construct(
2930
private MakerInterface $maker,
@@ -175,4 +176,11 @@ public function getPreRunCallbacks(): array
175176
{
176177
return $this->preRunCallbacks;
177178
}
179+
180+
public function skipOnWindows(): self
181+
{
182+
$this->skipOnWindows = true;
183+
184+
return $this;
185+
}
178186
}

tests/Maker/TemplateLinterTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ public function getTestDetails(): \Generator
3434
{
3535
yield 'lints_templates_with_custom_php_cs_fixer_and_config' => [$this->createMakerTest()
3636
->addExtraDependencies('friendsofphp/php-cs-fixer')
37+
// these tests are troublesome on Windows
38+
->skipOnWindows()
3739
->run(function (MakerTestRunner $runner) {
3840
$runner->copy('template-linter/php-cs-fixer.test.php', 'php-cs-fixer.test.php');
3941

@@ -60,6 +62,8 @@ public function getTestDetails(): \Generator
6062

6163
yield 'lints_templates_with_flex_generated_config_file' => [$this->createMakerTest()
6264
->addExtraDependencies('friendsofphp/php-cs-fixer')
65+
// these tests are troublesome on Windows
66+
->skipOnWindows()
6367
->run(function (MakerTestRunner $runner) {
6468
$runner->replaceInFile(
6569
'.php-cs-fixer.dist.php',

0 commit comments

Comments
 (0)