2019-04-21 16:30:02 +00:00
|
|
|
<?php
|
2019-10-03 19:24:12 +00:00
|
|
|
|
2019-04-21 16:30:02 +00:00
|
|
|
/**
|
|
|
|
* PlaylistArchiveStreamTest class.
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace Alltube\Test;
|
|
|
|
|
|
|
|
use Alltube\Config;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
/**
|
2019-04-22 14:05:58 +00:00
|
|
|
* Abstract class used by every test.
|
2019-04-21 16:30:02 +00:00
|
|
|
*/
|
|
|
|
abstract class BaseTest extends TestCase
|
|
|
|
{
|
|
|
|
/**
|
2019-04-21 17:14:23 +00:00
|
|
|
* Get the config file used in tests.
|
|
|
|
*
|
|
|
|
* @return string Path to file
|
2019-04-21 16:30:02 +00:00
|
|
|
*/
|
2019-04-21 17:14:23 +00:00
|
|
|
protected function getConfigFile()
|
2019-04-21 16:30:02 +00:00
|
|
|
{
|
|
|
|
if (PHP_OS == 'WINNT') {
|
|
|
|
$configFile = 'config_test_windows.yml';
|
|
|
|
} else {
|
|
|
|
$configFile = 'config_test.yml';
|
|
|
|
}
|
|
|
|
|
2019-10-03 19:24:12 +00:00
|
|
|
return __DIR__ . '/../config/' . $configFile;
|
2019-04-21 17:14:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare tests.
|
|
|
|
*/
|
|
|
|
protected function setUp()
|
|
|
|
{
|
|
|
|
Config::setFile($this->getConfigFile());
|
2019-04-21 16:30:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Destroy properties after test.
|
|
|
|
*/
|
|
|
|
protected function tearDown()
|
|
|
|
{
|
|
|
|
Config::destroyInstance();
|
|
|
|
}
|
2019-10-26 14:13:08 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check tests requirements.
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function checkRequirements()
|
|
|
|
{
|
|
|
|
parent::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.');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-04-21 16:30:02 +00:00
|
|
|
}
|