More robust way to detect CI in tests

This commit is contained in:
Pierre Rudloff 2022-02-07 22:30:47 +01:00
parent fe771886d9
commit 18847e4d75
1 changed files with 3 additions and 1 deletions

View File

@ -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.');
}
}