More robust way to detect CI in tests
This commit is contained in:
parent
fe771886d9
commit
18847e4d75
1 changed files with 3 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
namespace Alltube\Test;
|
namespace Alltube\Test;
|
||||||
|
|
||||||
|
use OndraM\CiDetector\CiDetector;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use PHPUnit\Util\Test;
|
use PHPUnit\Util\Test;
|
||||||
|
|
||||||
|
@ -38,6 +39,7 @@ abstract class BaseTest extends TestCase
|
||||||
*/
|
*/
|
||||||
protected function checkRequirements()
|
protected function checkRequirements()
|
||||||
{
|
{
|
||||||
|
$ciDetector = new CiDetector();
|
||||||
$annotations = Test::parseTestMethodAnnotations(
|
$annotations = Test::parseTestMethodAnnotations(
|
||||||
static::class,
|
static::class,
|
||||||
$this->getName()
|
$this->getName()
|
||||||
|
@ -52,7 +54,7 @@ abstract class BaseTest extends TestCase
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($requires as $require) {
|
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.');
|
$this->markTestSkipped('Do not run tests that download videos on CI.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue