feat: skipOnCI

This commit is contained in:
Nuno Maduro
2025-07-22 21:52:06 +01:00
parent 00572f5f8e
commit f9814793dd

View File

@ -314,6 +314,42 @@ final class TestCall // @phpstan-ignore-line
: $this;
}
/**
* Skips the current test when running on a CI environments.
*/
public function skipOnCI(): self
{
foreach ([
'CI',
'GITHUB_ACTIONS',
'GITLAB_CI',
'CIRCLECI',
'TRAVIS',
'APPVEYOR',
'BITBUCKET_BUILD_NUMBER',
'BUILDKITE',
'TEAMCITY_VERSION',
'JENKINS_URL',
'SYSTEM_COLLECTIONURI',
'CI_NAME',
'TASKCLUSTER_ROOT_URL',
'DRONE',
'WERCKER',
'NEVERCODE',
'SEMAPHORE',
'NETLIFY',
'NOW_BUILDER',
] as $env) {
if (isset($_ENV[$env])) {
return $this->skip(sprintf(
'This test is skipped on [CI].',
));
}
}
return $this;
}
/**
* Skips the current test unless the given test is running on Windows.
*/