diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index 8b237ec7..85a5848e 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -172,6 +172,17 @@ final class TestCall return $this; } + /** + * Skips the current test if the given test is running on Windows. + */ + public function skipOnWindows(): self + { + return $this->skip( + PHP_OS_FAMILY === 'Windows', + 'This test is skipped on Windows.', + ); + } + /** * Sets the test as "todo". */ diff --git a/tests/Visual/Collision.php b/tests/Visual/Collision.php index 896bfcb7..de6dad47 100644 --- a/tests/Visual/Collision.php +++ b/tests/Visual/Collision.php @@ -39,4 +39,4 @@ test('collision', function (array $arguments) { })->with([ [['']], [['--parallel']], -])->skip(PHP_OS_FAMILY === 'Windows'); +])->skipOnWindows(); diff --git a/tests/Visual/Help.php b/tests/Visual/Help.php index 9066f730..a3a77a87 100644 --- a/tests/Visual/Help.php +++ b/tests/Visual/Help.php @@ -18,4 +18,4 @@ test('visual snapshot of help command output', function () { } expect($output())->toContain(file_get_contents($snapshot)); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows(); diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php index f9c80ebf..6c266d5e 100644 --- a/tests/Visual/Parallel.php +++ b/tests/Visual/Parallel.php @@ -20,7 +20,7 @@ test('parallel', function () use ($run) { expect($run('--exclude-group=integration')) ->toContain('Tests: 2 deprecated, 3 warnings, 4 incomplete, 1 notice, 4 todos, 11 skipped, 697 passed (1696 assertions)') ->toContain('Parallel: 3 processes'); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows(); test('a parallel test can extend another test with same name', function () use ($run) { expect($run('tests/Fixtures/Inheritance'))->toContain('Tests: 1 skipped, 2 passed (2 assertions)'); diff --git a/tests/Visual/SingleTestOrDirectory.php b/tests/Visual/SingleTestOrDirectory.php index a8405475..21223275 100644 --- a/tests/Visual/SingleTestOrDirectory.php +++ b/tests/Visual/SingleTestOrDirectory.php @@ -24,11 +24,11 @@ $snapshot = function ($name) { test('allows to run a single test', function () use ($run, $snapshot) { expect($run('tests/Fixtures/DirectoryWithTests/ExampleTest.php'))->toContain($snapshot('allows-to-run-a-single-test')); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows(); test('allows to run a directory', function () use ($run, $snapshot) { expect($run('tests/Fixtures'))->toContain($snapshot('allows-to-run-a-directory')); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows(); it('disable decorating printer when colors is set to never', function () use ($snapshot) { $process = new Process([ @@ -40,4 +40,4 @@ it('disable decorating printer when colors is set to never', function () use ($s $process->run(); $output = $process->getOutput(); expect($output)->toContain($snapshot('disable-decorating-printer')); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows(); diff --git a/tests/Visual/Success.php b/tests/Visual/Success.php index 41cbcdce..ac0db670 100644 --- a/tests/Visual/Success.php +++ b/tests/Visual/Success.php @@ -41,4 +41,4 @@ test('visual snapshot of test suite on success', function () { expect(implode("\n", $output))->toContain(file_get_contents($snapshot)); } })->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE')) - ->skip(PHP_OS_FAMILY === 'Windows'); + ->skipOnWindows(); diff --git a/tests/Visual/Todo.php b/tests/Visual/Todo.php index edf1bb4e..43b9b9e3 100644 --- a/tests/Visual/Todo.php +++ b/tests/Visual/Todo.php @@ -26,8 +26,8 @@ $snapshot = function ($name) { test('todo', function () use ($run, $snapshot) { expect($run('--todos', false))->toContain($snapshot('todo')); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows(); test('todo in parallel', function () use ($run, $snapshot) { expect($run('--todos', true))->toContain($snapshot('todo')); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows(); diff --git a/tests/Visual/Version.php b/tests/Visual/Version.php index bdc2f514..7db09e3c 100644 --- a/tests/Visual/Version.php +++ b/tests/Visual/Version.php @@ -18,4 +18,4 @@ test('visual snapshot of help command output', function () { } expect($output())->toContain(file_get_contents($snapshot)); -})->skip(PHP_OS_FAMILY === 'Windows'); +})->skipOnWindows();