Do not run tests that download videos on CI
Travis get blacklisted by more and more services (Vimeo, Youtube, etc.)
This commit is contained in:
parent
9427a22a41
commit
1cab9623e9
9 changed files with 48 additions and 46 deletions
|
@ -45,4 +45,29 @@ abstract class BaseTest extends TestCase
|
||||||
{
|
{
|
||||||
Config::destroyInstance();
|
Config::destroyInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Alltube\Video;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the ConvertedPlaylistArchiveStream class.
|
* Unit tests for the ConvertedPlaylistArchiveStream class.
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
class ConvertedPlaylistArchiveStreamTest extends StreamTest
|
class ConvertedPlaylistArchiveStreamTest extends StreamTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Alltube\Controller\DownloadController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the FrontController class.
|
* Unit tests for the FrontController class.
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
class DownloadControllerTest extends ControllerTest
|
class DownloadControllerTest extends ControllerTest
|
||||||
{
|
{
|
||||||
|
@ -79,10 +80,6 @@ class DownloadControllerTest extends ControllerTest
|
||||||
*/
|
*/
|
||||||
public function testDownloadWithM3uStream()
|
public function testDownloadWithM3uStream()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Twitter returns a 429 error when the test is ran too many times.');
|
|
||||||
}
|
|
||||||
|
|
||||||
Config::setOptions(['stream' => true]);
|
Config::setOptions(['stream' => true]);
|
||||||
|
|
||||||
$this->assertRequestIsOk(
|
$this->assertRequestIsOk(
|
||||||
|
@ -153,9 +150,6 @@ class DownloadControllerTest extends ControllerTest
|
||||||
*/
|
*/
|
||||||
public function testDownloadWithMissingPassword()
|
public function testDownloadWithMissingPassword()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
$this->assertRequestIsRedirect('download', ['url' => 'http://vimeo.com/68375962']);
|
$this->assertRequestIsRedirect('download', ['url' => 'http://vimeo.com/68375962']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,6 +108,7 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function.
|
* Test the info() function.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfo()
|
public function testInfo()
|
||||||
{
|
{
|
||||||
|
@ -118,6 +119,7 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function with audio conversion.
|
* Test the info() function with audio conversion.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfoWithAudio()
|
public function testInfoWithAudio()
|
||||||
{
|
{
|
||||||
|
@ -133,12 +135,10 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function with audio conversion from a Vimeo video.
|
* Test the info() function with audio conversion from a Vimeo video.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfoWithVimeoAudio()
|
public function testInfoWithVimeoAudio()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
Config::setOptions(['convert' => true]);
|
Config::setOptions(['convert' => true]);
|
||||||
|
|
||||||
// So we can test the fallback to default format
|
// So we can test the fallback to default format
|
||||||
|
@ -149,6 +149,7 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function with audio enabled and an URL that doesn't need to be converted.
|
* Test the info() function with audio enabled and an URL that doesn't need to be converted.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfoWithUnconvertedAudio()
|
public function testInfoWithUnconvertedAudio()
|
||||||
{
|
{
|
||||||
|
@ -167,12 +168,10 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function with a password.
|
* Test the info() function with a password.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfoWithPassword()
|
public function testInfoWithPassword()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
$result = $this->controller->info(
|
$result = $this->controller->info(
|
||||||
$this->request->withQueryParams(['url' => 'http://vimeo.com/68375962'])
|
$this->request->withQueryParams(['url' => 'http://vimeo.com/68375962'])
|
||||||
->withParsedBody(['password' => 'youtube-dl']),
|
->withParsedBody(['password' => 'youtube-dl']),
|
||||||
|
@ -185,12 +184,10 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function with a missing password.
|
* Test the info() function with a missing password.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfoWithMissingPassword()
|
public function testInfoWithMissingPassword()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
$this->assertRequestIsOk('info', ['url' => 'http://vimeo.com/68375962']);
|
$this->assertRequestIsOk('info', ['url' => 'http://vimeo.com/68375962']);
|
||||||
$this->assertRequestIsOk('info', ['url' => 'http://vimeo.com/68375962', 'audio' => true]);
|
$this->assertRequestIsOk('info', ['url' => 'http://vimeo.com/68375962', 'audio' => true]);
|
||||||
}
|
}
|
||||||
|
@ -199,6 +196,7 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function with streams enabled.
|
* Test the info() function with streams enabled.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfoWithStream()
|
public function testInfoWithStream()
|
||||||
{
|
{
|
||||||
|
@ -215,6 +213,7 @@ class FrontControllerTest extends ControllerTest
|
||||||
* Test the info() function with a playlist.
|
* Test the info() function with a playlist.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testInfoWithPlaylist()
|
public function testInfoWithPlaylist()
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,6 +27,7 @@ class JsonControllerTest extends ControllerTest
|
||||||
* Test the json() function.
|
* Test the json() function.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testJson()
|
public function testJson()
|
||||||
{
|
{
|
||||||
|
@ -37,6 +38,7 @@ class JsonControllerTest extends ControllerTest
|
||||||
* Test the json() function with an error.
|
* Test the json() function with an error.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
public function testJsonWithError()
|
public function testJsonWithError()
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Alltube\Video;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the PlaylistArchiveStream class.
|
* Unit tests for the PlaylistArchiveStream class.
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
class PlaylistArchiveStreamTest extends StreamTest
|
class PlaylistArchiveStreamTest extends StreamTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Alltube\Video;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the Video class.
|
* Unit tests for the Video class.
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
class VideoTest extends BaseTest
|
class VideoTest extends BaseTest
|
||||||
{
|
{
|
||||||
|
@ -58,10 +59,6 @@ class VideoTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testgetUrlWithPassword()
|
public function testgetUrlWithPassword()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$video = new Video('http://vimeo.com/68375962', 'best', 'youtube-dl');
|
$video = new Video('http://vimeo.com/68375962', 'best', 'youtube-dl');
|
||||||
foreach ($video->getUrl() as $videoURL) {
|
foreach ($video->getUrl() as $videoURL) {
|
||||||
$this->assertContains('vimeocdn.com', $videoURL);
|
$this->assertContains('vimeocdn.com', $videoURL);
|
||||||
|
@ -76,10 +73,6 @@ class VideoTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testgetUrlWithMissingPassword()
|
public function testgetUrlWithMissingPassword()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$video = new Video('http://vimeo.com/68375962');
|
$video = new Video('http://vimeo.com/68375962');
|
||||||
$video->getUrl();
|
$video->getUrl();
|
||||||
}
|
}
|
||||||
|
@ -92,10 +85,6 @@ class VideoTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testgetUrlWithWrongPassword()
|
public function testgetUrlWithWrongPassword()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$video = new Video('http://vimeo.com/68375962', 'best', 'foo');
|
$video = new Video('http://vimeo.com/68375962', 'best', 'foo');
|
||||||
$video->getUrl();
|
$video->getUrl();
|
||||||
}
|
}
|
||||||
|
@ -148,17 +137,13 @@ class VideoTest extends BaseTest
|
||||||
'mp4',
|
'mp4',
|
||||||
'openload.co',
|
'openload.co',
|
||||||
],
|
],
|
||||||
];
|
[
|
||||||
|
|
||||||
if (!getenv('CI')) {
|
|
||||||
// Travis is blacklisted by Vimeo.
|
|
||||||
$videos[] = [
|
|
||||||
'https://vimeo.com/24195442', 'best[protocol^=http]',
|
'https://vimeo.com/24195442', 'best[protocol^=http]',
|
||||||
'Carving_the_Mountains-24195442',
|
'Carving_the_Mountains-24195442',
|
||||||
'mp4',
|
'mp4',
|
||||||
'vimeocdn.com',
|
'vimeocdn.com',
|
||||||
];
|
]
|
||||||
}
|
];
|
||||||
|
|
||||||
return $videos;
|
return $videos;
|
||||||
}
|
}
|
||||||
|
@ -187,17 +172,14 @@ class VideoTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function m3uUrlProvider()
|
public function m3uUrlProvider()
|
||||||
{
|
{
|
||||||
$videos = [];
|
$videos = [
|
||||||
|
[
|
||||||
if (!getenv('CI')) {
|
|
||||||
// Twitter returns a 429 error when the test is ran too many times.
|
|
||||||
$videos[] = [
|
|
||||||
'https://twitter.com/verge/status/813055465324056576/video/1', 'hls-2176',
|
'https://twitter.com/verge/status/813055465324056576/video/1', 'hls-2176',
|
||||||
'The_Verge_-_This_tiny_origami_robot_can_self-fold_and_complete_tasks-813055465324056576',
|
'The_Verge_-_This_tiny_origami_robot_can_self-fold_and_complete_tasks-813055465324056576',
|
||||||
'mp4',
|
'mp4',
|
||||||
'video.twimg.com',
|
'video.twimg.com',
|
||||||
];
|
]
|
||||||
}
|
];
|
||||||
|
|
||||||
return $videos;
|
return $videos;
|
||||||
}
|
}
|
||||||
|
@ -359,10 +341,6 @@ class VideoTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamDashError()
|
public function testGetAudioStreamDashError()
|
||||||
{
|
{
|
||||||
if (getenv('CI')) {
|
|
||||||
$this->markTestSkipped('Travis is blacklisted by Vimeo.');
|
|
||||||
}
|
|
||||||
|
|
||||||
$video = new Video('https://vimeo.com/251997032', 'bestaudio/best');
|
$video = new Video('https://vimeo.com/251997032', 'bestaudio/best');
|
||||||
$video->getAudioStream();
|
$video->getAudioStream();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Alltube\Video;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the YoutubeChunkStream class.
|
* Unit tests for the YoutubeChunkStream class.
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
class YoutubeChunkStreamTest extends StreamTest
|
class YoutubeChunkStreamTest extends StreamTest
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,7 @@ use Alltube\Video;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the YoutubeStream class.
|
* Unit tests for the YoutubeStream class.
|
||||||
|
* @requires download
|
||||||
*/
|
*/
|
||||||
class YoutubeStreamTest extends StreamTest
|
class YoutubeStreamTest extends StreamTest
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue