Switch to phpunit 8

This commit is contained in:
Pierre Rudloff 2019-11-30 14:08:18 +01:00
parent 54f41d9396
commit fea1cce2d4
21 changed files with 330 additions and 335 deletions

View file

@ -8,6 +8,7 @@ namespace Alltube\Test;
use Alltube\Config;
use Alltube\Video;
use Exception;
/**
* Unit tests for the Video class.
@ -48,7 +49,7 @@ class VideoTest extends BaseTest
) {
$video = new Video($url, $format);
foreach ($video->getUrl() as $videoURL) {
$this->assertContains($domain, $videoURL);
$this->assertStringContainsString($domain, $videoURL);
}
}
@ -61,7 +62,7 @@ class VideoTest extends BaseTest
{
$video = new Video('http://vimeo.com/68375962', 'best', 'youtube-dl');
foreach ($video->getUrl() as $videoURL) {
$this->assertContains('vimeocdn.com', $videoURL);
$this->assertStringContainsString('vimeocdn.com', $videoURL);
}
}
@ -69,10 +70,10 @@ class VideoTest extends BaseTest
* Test getUrl function with a protected video and no password.
*
* @return void
* @expectedException Alltube\Exception\PasswordException
*/
public function testgetUrlWithMissingPassword()
{
$this->expectException(Exception::class);
$video = new Video('http://vimeo.com/68375962');
$video->getUrl();
}
@ -81,10 +82,10 @@ class VideoTest extends BaseTest
* Test getUrl function with a protected video and a wrong password.
*
* @return void
* @expectedException Exception
*/
public function testgetUrlWithWrongPassword()
{
$this->expectException(Exception::class);
$video = new Video('http://vimeo.com/68375962', 'best', 'foo');
$video->getUrl();
}
@ -95,11 +96,11 @@ class VideoTest extends BaseTest
* @param string $url URL
*
* @return void
* @expectedException Exception
* @dataProvider ErrorUrlProvider
*/
public function testgetUrlError($url)
{
$this->expectException(Exception::class);
$video = new Video($url);
$video->getUrl();
}
@ -132,16 +133,10 @@ class VideoTest extends BaseTest
'bbcodspdns.fcod.llnwd.net',
],
[
'https://openload.co/f/kUEfGclsU9o', 'best[protocol^=http]',
'skyrim_no-audio_1080.mp4-kUEfGclsU9o',
'mp4',
'openload.co',
],
[
'https://vimeo.com/24195442', 'best[protocol^=http]',
'https://vimeo.com/24195442', 'http-720p',
'Carving_the_Mountains-24195442',
'mp4',
'vimeocdn.com',
'gcs-vimeo.akamaized.net',
]
];
@ -241,11 +236,11 @@ class VideoTest extends BaseTest
* @param string $url URL
*
* @return void
* @expectedException Exception
* @dataProvider ErrorURLProvider
*/
public function testGetJsonError($url)
{
$this->expectException(Exception::class);
$video = new Video($url);
$video->getJson();
}
@ -275,11 +270,11 @@ class VideoTest extends BaseTest
* @param string $url URL
*
* @return void
* @expectedException Exception
* @dataProvider ErrorUrlProvider
*/
public function testGetFilenameError($url)
{
$this->expectException(Exception::class);
$video = new Video($url);
$video->getFilename();
}
@ -306,11 +301,11 @@ class VideoTest extends BaseTest
* @param string $format Format
*
* @return void
* @expectedException Exception
* @dataProvider urlProvider
*/
public function testGetAudioStreamAvconvError($url, $format)
{
$this->expectException(Exception::class);
Config::setOptions(['avconv' => 'foobar']);
$video = new Video($url, $format);
@ -324,11 +319,11 @@ class VideoTest extends BaseTest
* @param string $format Format
*
* @return void
* @expectedException Exception
* @dataProvider m3uUrlProvider
*/
public function testGetAudioStreamM3uError($url, $format)
{
$this->expectException(Exception::class);
$video = new Video($url, $format);
$video->getAudioStream();
}
@ -337,10 +332,10 @@ class VideoTest extends BaseTest
* Test getAudioStream function with a DASH URL.
*
* @return void
* @expectedException Exception
*/
public function testGetAudioStreamDashError()
{
$this->expectException(Exception::class);
$video = new Video('https://vimeo.com/251997032', 'bestaudio/best');
$video->getAudioStream();
}
@ -349,10 +344,10 @@ class VideoTest extends BaseTest
* Test getAudioStream function with a playlist.
*
* @return void
* @expectedException Exception
*/
public function testGetAudioStreamPlaylistError()
{
$this->expectException(Exception::class);
$video = new Video(
'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC',
'best'
@ -369,7 +364,7 @@ class VideoTest extends BaseTest
*/
private function assertStream($stream)
{
$this->assertInternalType('resource', $stream);
$this->assertIsResource($stream);
$this->assertFalse(feof($stream));
}
@ -411,10 +406,10 @@ class VideoTest extends BaseTest
*
* @return void
* @dataProvider urlProvider
* @expectedException Exception
*/
public function testGetRemuxStreamWithWrongVideo($url, $format)
{
$this->expectException(Exception::class);
$video = new Video($url, $format);
$video->getRemuxStream();
}
@ -444,11 +439,11 @@ class VideoTest extends BaseTest
* @param string $format Format
*
* @return void
* @expectedException Exception
* @dataProvider m3uUrlProvider
*/
public function testGetM3uStreamAvconvError($url, $format)
{
$this->expectException(Exception::class);
Config::setOptions(['avconv' => 'foobar']);
$video = new Video($url, $format);
@ -477,11 +472,11 @@ class VideoTest extends BaseTest
* @param string $format Format
*
* @return void
* @expectedException Exception
* @dataProvider m3uUrlProvider
*/
public function testGetConvertedStreamM3uError($url, $format)
{
$this->expectException(Exception::class);
$video = new Video($url, $format);
$video->getConvertedStream(32, 'flv');
}