From 18847e4d75e77abf4d0d65e17a030e9d27e1db37 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 7 Feb 2022 22:30:47 +0100 Subject: [PATCH] More robust way to detect CI in tests --- tests/BaseTest.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/BaseTest.php b/tests/BaseTest.php index a4ba2c6..052927a 100644 --- a/tests/BaseTest.php +++ b/tests/BaseTest.php @@ -6,6 +6,7 @@ namespace Alltube\Test; +use OndraM\CiDetector\CiDetector; use PHPUnit\Framework\TestCase; use PHPUnit\Util\Test; @@ -38,6 +39,7 @@ abstract class BaseTest extends TestCase */ protected function checkRequirements() { + $ciDetector = new CiDetector(); $annotations = Test::parseTestMethodAnnotations( static::class, $this->getName() @@ -52,7 +54,7 @@ abstract class BaseTest extends TestCase } foreach ($requires as $require) { - if ($require == 'download' && getenv('CI')) { + if ($require == 'download' && $ciDetector->isCiDetected()) { $this->markTestSkipped('Do not run tests that download videos on CI.'); } }