1
0
mirror of https://github.com/Rudloff/alltube.git synced 2024-06-25 07:27:46 +02:00
alltube/tests/BaseTest.php
Pierre Rudloff 7a2c7b42fb Remove Windows test config file
We don't have a Windows CI anymore
2020-06-22 23:22:42 +02:00

69 lines
1.4 KiB
PHP

<?php
/**
* PlaylistArchiveStreamTest class.
*/
namespace Alltube\Test;
use Alltube\Config;
use Alltube\Exception\ConfigException;
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.
* @throws ConfigException
*/
protected function setUp(): void
{
Config::setFile($this->getConfigFile());
$this->checkRequirements();
}
/**
* Destroy properties after test.
*/
protected function tearDown(): void
{
Config::destroyInstance();
}
/**
* Check tests requirements.
* @return void
*/
protected function checkRequirements()
{
$annotations = $this->getAnnotations();
$requires = [];
if (isset($annotations['class']['requires'])) {
$requires += $annotations['class']['requires'];
}
if (isset($annotations['method']['requires'])) {
$requires += $annotations['method']['requires'];
}
foreach ($requires as $require) {
if ($require == 'download' && getenv('CI')) {
$this->markTestSkipped('Do not run tests that download videos on CI.');
}
}
}
}