From f618087eb966f5c3572e8e0049b49f55b346d41d Mon Sep 17 00:00:00 2001 From: Freek Van der Herten Date: Thu, 14 Dec 2023 11:51:57 +0100 Subject: [PATCH] "Skip test when running on GitHub actions" --- tests/Manipulations/BorderTest.php | 2 +- tests/Pest.php | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/tests/Manipulations/BorderTest.php b/tests/Manipulations/BorderTest.php index 9c362353..d1a636e8 100644 --- a/tests/Manipulations/BorderTest.php +++ b/tests/Manipulations/BorderTest.php @@ -16,4 +16,4 @@ [[50, BorderType::Overlay, '333333']], [[100, BorderType::Shrink, 'FAAAAA']], [[100, BorderType::Expand, 'FAAAAA']], -]); +])->skipWhenRunningOnGitHub(); diff --git a/tests/Pest.php b/tests/Pest.php index c78f5a48..2db6ce7f 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -70,3 +70,17 @@ function skipIfImagickDoesNotSupportFormat(string $format) test()->markTestSkipped('Imagick does not support this format.'); } } + +function skipWhenRunningOnGitHub(): void +{ + if (getenv('GITHUB_ACTIONS') !== false) { + test()->markTestSkipped('This test cannot run on GitHub actions'); + } +} + +function skipWhenRunningLocally(): void +{ + if (getenv('GITHUB_ACTIONS') === false) { + test()->markTestSkipped('This test cannot run locally'); + } +}