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 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
|
|
|
*/
|
2020-12-17 21:43:05 +00:00
|
|
|
protected function getConfigFile(): string
|
2019-04-21 16:30:02 +00:00
|
|
|
{
|
2020-06-22 21:22:42 +00:00
|
|
|
return __DIR__ . '/../config/config_test.yml';
|
2019-04-21 17:14:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Prepare tests.
|
|
|
|
*/
|
2019-11-30 13:08:18 +00:00
|
|
|
protected function setUp(): void
|
2019-04-21 17:14:23 +00:00
|
|
|
{
|
2019-11-30 13:08:18 +00:00
|
|
|
$this->checkRequirements();
|
2019-04-21 16:30:02 +00:00
|
|
|
}
|
|
|
|
|
2019-10-26 14:13:08 +00:00
|
|
|
/**
|
|
|
|
* Check tests requirements.
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
protected function checkRequirements()
|
|
|
|
{
|
|
|
|
$annotations = $this->getAnnotations();
|
|
|
|
$requires = [];
|
|
|
|
|
|
|
|
if (isset($annotations['class']['requires'])) {
|
2020-10-17 13:09:34 +00:00
|
|
|
$requires = array_merge($requires, $annotations['class']['requires']);
|
2019-10-26 14:13:08 +00:00
|
|
|
}
|
|
|
|
if (isset($annotations['method']['requires'])) {
|
2020-10-17 13:09:34 +00:00
|
|
|
$requires = array_merge($requires, $annotations['method']['requires']);
|
2019-10-26 14:13:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
}
|