1
0
mirror of https://github.com/Rudloff/alltube.git synced 2024-06-25 07:27:46 +02:00
alltube/tests/BaseTest.php

57 lines
1.2 KiB
PHP
Raw Normal View History

<?php
/**
* PlaylistArchiveStreamTest class.
*/
namespace Alltube\Test;
use PHPUnit\Framework\TestCase;
/**
* Abstract class used by every test.
*/
abstract class BaseTest extends TestCase
{
/**
* Get the config file used in tests.
*
* @return string Path to file
*/
protected function getConfigFile()
{
return __DIR__ . '/../config/config_test.yml';
}
/**
* Prepare tests.
*/
2019-11-30 14:08:18 +01:00
protected function setUp(): void
{
2019-11-30 14:08:18 +01:00
$this->checkRequirements();
}
/**
* Check tests requirements.
* @return void
*/
protected function checkRequirements()
{
$annotations = $this->getAnnotations();
$requires = [];
if (isset($annotations['class']['requires'])) {
$requires = array_merge($requires, $annotations['class']['requires']);
}
if (isset($annotations['method']['requires'])) {
$requires = array_merge($requires, $annotations['method']['requires']);
}
foreach ($requires as $require) {
if ($require == 'download' && getenv('CI')) {
$this->markTestSkipped('Do not run tests that download videos on CI.');
}
}
}
}