From 1c1cb1e591f5020c57724038fd8d44abe5413445 Mon Sep 17 00:00:00 2001 From: faissaloux Date: Fri, 31 Mar 2023 22:03:18 +0000 Subject: [PATCH 1/3] skip os family --- src/PendingCalls/TestCall.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index 85a5848e..a178018c 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -172,15 +172,23 @@ final class TestCall return $this; } + /** + * Skips the current test if the given test is running on given os family. + */ + public function skipOsFamily(string $osFamily): self + { + return $this->skip( + PHP_OS_FAMILY === $osFamily, + "This test is skipped on $osFamily.", + ); + } + /** * 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.', - ); + return $this->skipOsFamily('Windows'); } /** From c1979f735f09353f829a1b2fa527da600aca596e Mon Sep 17 00:00:00 2001 From: faissaloux Date: Fri, 31 Mar 2023 22:09:45 +0000 Subject: [PATCH 2/3] add ability to skip on multiple os families --- src/PendingCalls/TestCall.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index a178018c..d269c6ab 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -175,12 +175,15 @@ final class TestCall /** * Skips the current test if the given test is running on given os family. */ - public function skipOsFamily(string $osFamily): self + public function skipOsFamily(string ...$osFamilies): self { - return $this->skip( - PHP_OS_FAMILY === $osFamily, - "This test is skipped on $osFamily.", - ); + foreach ($osFamilies as $osFamily) { + if (PHP_OS_FAMILY === $osFamily) { + return $this->skip( + "This test is skipped on $osFamily.", + ); + } + } } /** From a6dec31b9d5d9b0030beb2356d72b458a747e311 Mon Sep 17 00:00:00 2001 From: faissaloux Date: Fri, 31 Mar 2023 22:11:32 +0000 Subject: [PATCH 3/3] fix return --- src/PendingCalls/TestCall.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/PendingCalls/TestCall.php b/src/PendingCalls/TestCall.php index d269c6ab..0b6139d6 100644 --- a/src/PendingCalls/TestCall.php +++ b/src/PendingCalls/TestCall.php @@ -184,6 +184,8 @@ final class TestCall ); } } + + return $this; } /**