Switch to phpunit 8
This commit is contained in:
parent
54f41d9396
commit
fea1cce2d4
21 changed files with 330 additions and 335 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -13,3 +13,4 @@ config/config.yml
|
||||||
docs/
|
docs/
|
||||||
clover.xml
|
clover.xml
|
||||||
i18n/*/LC_MESSAGES/*.mo
|
i18n/*/LC_MESSAGES/*.mo
|
||||||
|
.phpunit.result.cache
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
"ffmpeg/ffmpeg": "^4.1",
|
"ffmpeg/ffmpeg": "^4.1",
|
||||||
"heroku/heroku-buildpack-php": "^162.0",
|
"heroku/heroku-buildpack-php": "^162.0",
|
||||||
"phpstan/phpstan": "~0.9.2",
|
"phpstan/phpstan": "~0.9.2",
|
||||||
"phpunit/phpunit": "~6.5.2",
|
"phpunit/phpunit": "^8.4",
|
||||||
"rg3/youtube-dl": "^2019.09",
|
"rg3/youtube-dl": "^2019.09",
|
||||||
"roave/security-advisories": "dev-master",
|
"roave/security-advisories": "dev-master",
|
||||||
"smarty-gettext/smarty-gettext": "^1.6",
|
"smarty-gettext/smarty-gettext": "^1.6",
|
||||||
|
|
516
composer.lock
generated
516
composer.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -7,7 +7,7 @@
|
||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
<testsuites>
|
<testsuites>
|
||||||
<testsuite>
|
<testsuite name="Tests">
|
||||||
<directory>tests/</directory>
|
<directory>tests/</directory>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
|
|
@ -33,15 +33,16 @@ abstract class BaseTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
Config::setFile($this->getConfigFile());
|
Config::setFile($this->getConfigFile());
|
||||||
|
$this->checkRequirements();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroy properties after test.
|
* Destroy properties after test.
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
Config::destroyInstance();
|
Config::destroyInstance();
|
||||||
}
|
}
|
||||||
|
@ -52,8 +53,6 @@ abstract class BaseTest extends TestCase
|
||||||
*/
|
*/
|
||||||
protected function checkRequirements()
|
protected function checkRequirements()
|
||||||
{
|
{
|
||||||
parent::checkRequirements();
|
|
||||||
|
|
||||||
$annotations = $this->getAnnotations();
|
$annotations = $this->getAnnotations();
|
||||||
$requires = [];
|
$requires = [];
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
namespace Alltube\Test;
|
namespace Alltube\Test;
|
||||||
|
|
||||||
use Alltube\Config;
|
use Alltube\Config;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the Config class.
|
* Unit tests for the Config class.
|
||||||
|
@ -23,7 +24,7 @@ class ConfigTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -65,15 +66,15 @@ class ConfigTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
private function assertConfig(Config $config)
|
private function assertConfig(Config $config)
|
||||||
{
|
{
|
||||||
$this->assertInternalType('array', $config->params);
|
$this->assertIsArray($config->params);
|
||||||
$this->assertInternalType('string', $config->youtubedl);
|
$this->assertIsString($config->youtubedl);
|
||||||
$this->assertInternalType('string', $config->python);
|
$this->assertIsString($config->python);
|
||||||
$this->assertInternalType('string', $config->avconv);
|
$this->assertIsString($config->avconv);
|
||||||
$this->assertInternalType('bool', $config->convert);
|
$this->assertIsBool($config->convert);
|
||||||
$this->assertInternalType('bool', $config->uglyUrls);
|
$this->assertIsBool($config->uglyUrls);
|
||||||
$this->assertInternalType('bool', $config->stream);
|
$this->assertIsBool($config->stream);
|
||||||
$this->assertInternalType('bool', $config->remux);
|
$this->assertIsBool($config->remux);
|
||||||
$this->assertInternalType('int', $config->audioBitrate);
|
$this->assertIsInt($config->audioBitrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,10 +92,10 @@ class ConfigTest extends BaseTest
|
||||||
* Test the setFile function with a missing config file.
|
* Test the setFile function with a missing config file.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testSetFileWithMissingFile()
|
public function testSetFileWithMissingFile()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
Config::setFile('foo');
|
Config::setFile('foo');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,10 +133,10 @@ class ConfigTest extends BaseTest
|
||||||
* Test the setOptions function.
|
* Test the setOptions function.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testSetOptionsWithBadYoutubedl()
|
public function testSetOptionsWithBadYoutubedl()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
Config::setOptions(['youtubedl' => 'foo']);
|
Config::setOptions(['youtubedl' => 'foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,10 +144,10 @@ class ConfigTest extends BaseTest
|
||||||
* Test the setOptions function.
|
* Test the setOptions function.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testSetOptionsWithBadPython()
|
public function testSetOptionsWithBadPython()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
Config::setOptions(['python' => 'foo']);
|
Config::setOptions(['python' => 'foo']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ abstract class ControllerTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class ConvertedPlaylistArchiveStreamTest extends StreamTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class DownloadControllerTest extends ControllerTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class FrontControllerTest extends ControllerTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class JsonControllerTest extends ControllerTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ class LocaleManagerTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$_SESSION[LocaleManager::class]['locale'] = 'foo_BAR';
|
$_SESSION[LocaleManager::class]['locale'] = 'foo_BAR';
|
||||||
$this->localeManager = LocaleManager::getInstance();
|
$this->localeManager = LocaleManager::getInstance();
|
||||||
|
@ -35,7 +35,7 @@ class LocaleManagerTest extends BaseTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$this->localeManager->unsetLocale();
|
$this->localeManager->unsetLocale();
|
||||||
LocaleManager::destroyInstance();
|
LocaleManager::destroyInstance();
|
||||||
|
|
|
@ -36,7 +36,7 @@ class LocaleMiddlewareTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->container = new Container();
|
$this->container = new Container();
|
||||||
$this->container['locale'] = LocaleManager::getInstance();
|
$this->container['locale'] = LocaleManager::getInstance();
|
||||||
|
@ -48,7 +48,7 @@ class LocaleMiddlewareTest extends BaseTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$this->container['locale']->unsetLocale();
|
$this->container['locale']->unsetLocale();
|
||||||
LocaleManager::destroyInstance();
|
LocaleManager::destroyInstance();
|
||||||
|
|
|
@ -23,7 +23,7 @@ class LocaleTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->localeObject = new Locale('fr_FR');
|
$this->localeObject = new Locale('fr_FR');
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class PlaylistArchiveStreamTest extends StreamTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
$this->stream->close();
|
$this->stream->close();
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testTell()
|
public function testTell()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('int', $this->stream->tell());
|
$this->assertIsInt($this->stream->tell());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,7 @@ abstract class StreamTest extends BaseTest
|
||||||
public function testRead()
|
public function testRead()
|
||||||
{
|
{
|
||||||
$result = $this->stream->read(8192);
|
$result = $this->stream->read(8192);
|
||||||
$this->assertInternalType('string', $result);
|
$this->assertIsString($result);
|
||||||
$this->assertLessThanOrEqual(8192, strlen($result));
|
$this->assertLessThanOrEqual(8192, strlen($result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,7 +123,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testIsSeekable()
|
public function testIsSeekable()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('boolean', $this->stream->isSeekable());
|
$this->assertIsBool($this->stream->isSeekable());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,7 +154,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testIsWritable()
|
public function testIsWritable()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('boolean', $this->stream->isWritable());
|
$this->assertIsBool($this->stream->isWritable());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,7 +174,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testGetContents()
|
public function testGetContents()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('string', $this->stream->getContents());
|
$this->assertIsString($this->stream->getContents());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -184,7 +184,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testGetMetadata()
|
public function testGetMetadata()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('array', $this->stream->getMetadata());
|
$this->assertIsArray($this->stream->getMetadata());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,9 +194,9 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testGetMetadataWithKey()
|
public function testGetMetadataWithKey()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('string', $this->stream->getMetadata('stream_type'));
|
$this->assertIsString($this->stream->getMetadata('stream_type'));
|
||||||
$this->assertInternalType('string', $this->stream->getMetadata('mode'));
|
$this->assertIsString($this->stream->getMetadata('mode'));
|
||||||
$this->assertInternalType('boolean', $this->stream->getMetadata('seekable'));
|
$this->assertIsBool($this->stream->getMetadata('seekable'));
|
||||||
$this->assertNull($this->stream->getMetadata('foo'));
|
$this->assertNull($this->stream->getMetadata('foo'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testDetach()
|
public function testDetach()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('resource', $this->stream->detach());
|
$this->assertIsResource($this->stream->detach());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -217,7 +217,7 @@ abstract class StreamTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
public function testToString()
|
public function testToString()
|
||||||
{
|
{
|
||||||
$this->assertInternalType('string', $this->stream->__toString());
|
$this->assertIsString($this->stream->__toString());
|
||||||
$this->assertInternalType('string', (string) $this->stream);
|
$this->assertIsString((string) $this->stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ class UglyRouterTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
$this->router = new UglyRouter();
|
$this->router = new UglyRouter();
|
||||||
$this->router->map(['GET'], '/foo', 'print')->setName('foo');
|
$this->router->map(['GET'], '/foo', 'print')->setName('foo');
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Alltube\Test;
|
||||||
use Alltube\Video;
|
use Alltube\Video;
|
||||||
use Mockery;
|
use Mockery;
|
||||||
use phpmock\mockery\PHPMockery;
|
use phpmock\mockery\PHPMockery;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the Video class.
|
* Unit tests for the Video class.
|
||||||
|
@ -26,7 +27,7 @@ class VideoStubsTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Initialize properties used by test.
|
* Initialize properties used by test.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ class VideoStubsTest extends BaseTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown(): void
|
||||||
{
|
{
|
||||||
Mockery::close();
|
Mockery::close();
|
||||||
}
|
}
|
||||||
|
@ -50,10 +51,10 @@ class VideoStubsTest extends BaseTest
|
||||||
* Test getAudioStream function with a buggy popen.
|
* Test getAudioStream function with a buggy popen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamWithPopenError()
|
public function testGetAudioStreamWithPopenError()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$this->video->getAudioStream();
|
$this->video->getAudioStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,10 +62,10 @@ class VideoStubsTest extends BaseTest
|
||||||
* Test getM3uStream function with a buggy popen.
|
* Test getM3uStream function with a buggy popen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetM3uStreamWithPopenError()
|
public function testGetM3uStreamWithPopenError()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$this->video->getM3uStream();
|
$this->video->getM3uStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,10 +73,10 @@ class VideoStubsTest extends BaseTest
|
||||||
* Test getRtmpStream function with a buggy popen.
|
* Test getRtmpStream function with a buggy popen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetRtmpStreamWithPopenError()
|
public function testGetRtmpStreamWithPopenError()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$this->video->getRtmpStream();
|
$this->video->getRtmpStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,10 +84,10 @@ class VideoStubsTest extends BaseTest
|
||||||
* Test getRemuxStream function with a buggy popen.
|
* Test getRemuxStream function with a buggy popen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetRemuxStreamWithPopenError()
|
public function testGetRemuxStreamWithPopenError()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = $this->video->withFormat('bestvideo+bestaudio');
|
$video = $this->video->withFormat('bestvideo+bestaudio');
|
||||||
$video->getRemuxStream();
|
$video->getRemuxStream();
|
||||||
}
|
}
|
||||||
|
@ -95,10 +96,10 @@ class VideoStubsTest extends BaseTest
|
||||||
* Test getConvertedStream function with a buggy popen.
|
* Test getConvertedStream function with a buggy popen.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetConvertedStreamWithPopenError()
|
public function testGetConvertedStreamWithPopenError()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$this->video->getConvertedStream(32, 'flv');
|
$this->video->getConvertedStream(32, 'flv');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace Alltube\Test;
|
||||||
|
|
||||||
use Alltube\Config;
|
use Alltube\Config;
|
||||||
use Alltube\Video;
|
use Alltube\Video;
|
||||||
|
use Exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the Video class.
|
* Unit tests for the Video class.
|
||||||
|
@ -48,7 +49,7 @@ class VideoTest extends BaseTest
|
||||||
) {
|
) {
|
||||||
$video = new Video($url, $format);
|
$video = new Video($url, $format);
|
||||||
foreach ($video->getUrl() as $videoURL) {
|
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');
|
$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->assertStringContainsString('vimeocdn.com', $videoURL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,10 +70,10 @@ class VideoTest extends BaseTest
|
||||||
* Test getUrl function with a protected video and no password.
|
* Test getUrl function with a protected video and no password.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Alltube\Exception\PasswordException
|
|
||||||
*/
|
*/
|
||||||
public function testgetUrlWithMissingPassword()
|
public function testgetUrlWithMissingPassword()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video('http://vimeo.com/68375962');
|
$video = new Video('http://vimeo.com/68375962');
|
||||||
$video->getUrl();
|
$video->getUrl();
|
||||||
}
|
}
|
||||||
|
@ -81,10 +82,10 @@ class VideoTest extends BaseTest
|
||||||
* Test getUrl function with a protected video and a wrong password.
|
* Test getUrl function with a protected video and a wrong password.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testgetUrlWithWrongPassword()
|
public function testgetUrlWithWrongPassword()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video('http://vimeo.com/68375962', 'best', 'foo');
|
$video = new Video('http://vimeo.com/68375962', 'best', 'foo');
|
||||||
$video->getUrl();
|
$video->getUrl();
|
||||||
}
|
}
|
||||||
|
@ -95,11 +96,11 @@ class VideoTest extends BaseTest
|
||||||
* @param string $url URL
|
* @param string $url URL
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
* @dataProvider ErrorUrlProvider
|
* @dataProvider ErrorUrlProvider
|
||||||
*/
|
*/
|
||||||
public function testgetUrlError($url)
|
public function testgetUrlError($url)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video($url);
|
$video = new Video($url);
|
||||||
$video->getUrl();
|
$video->getUrl();
|
||||||
}
|
}
|
||||||
|
@ -132,16 +133,10 @@ class VideoTest extends BaseTest
|
||||||
'bbcodspdns.fcod.llnwd.net',
|
'bbcodspdns.fcod.llnwd.net',
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'https://openload.co/f/kUEfGclsU9o', 'best[protocol^=http]',
|
'https://vimeo.com/24195442', 'http-720p',
|
||||||
'skyrim_no-audio_1080.mp4-kUEfGclsU9o',
|
|
||||||
'mp4',
|
|
||||||
'openload.co',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'https://vimeo.com/24195442', 'best[protocol^=http]',
|
|
||||||
'Carving_the_Mountains-24195442',
|
'Carving_the_Mountains-24195442',
|
||||||
'mp4',
|
'mp4',
|
||||||
'vimeocdn.com',
|
'gcs-vimeo.akamaized.net',
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -241,11 +236,11 @@ class VideoTest extends BaseTest
|
||||||
* @param string $url URL
|
* @param string $url URL
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
* @dataProvider ErrorURLProvider
|
* @dataProvider ErrorURLProvider
|
||||||
*/
|
*/
|
||||||
public function testGetJsonError($url)
|
public function testGetJsonError($url)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video($url);
|
$video = new Video($url);
|
||||||
$video->getJson();
|
$video->getJson();
|
||||||
}
|
}
|
||||||
|
@ -275,11 +270,11 @@ class VideoTest extends BaseTest
|
||||||
* @param string $url URL
|
* @param string $url URL
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
* @dataProvider ErrorUrlProvider
|
* @dataProvider ErrorUrlProvider
|
||||||
*/
|
*/
|
||||||
public function testGetFilenameError($url)
|
public function testGetFilenameError($url)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video($url);
|
$video = new Video($url);
|
||||||
$video->getFilename();
|
$video->getFilename();
|
||||||
}
|
}
|
||||||
|
@ -306,11 +301,11 @@ class VideoTest extends BaseTest
|
||||||
* @param string $format Format
|
* @param string $format Format
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
* @dataProvider urlProvider
|
* @dataProvider urlProvider
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamAvconvError($url, $format)
|
public function testGetAudioStreamAvconvError($url, $format)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
Config::setOptions(['avconv' => 'foobar']);
|
Config::setOptions(['avconv' => 'foobar']);
|
||||||
|
|
||||||
$video = new Video($url, $format);
|
$video = new Video($url, $format);
|
||||||
|
@ -324,11 +319,11 @@ class VideoTest extends BaseTest
|
||||||
* @param string $format Format
|
* @param string $format Format
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
* @dataProvider m3uUrlProvider
|
* @dataProvider m3uUrlProvider
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamM3uError($url, $format)
|
public function testGetAudioStreamM3uError($url, $format)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video($url, $format);
|
$video = new Video($url, $format);
|
||||||
$video->getAudioStream();
|
$video->getAudioStream();
|
||||||
}
|
}
|
||||||
|
@ -337,10 +332,10 @@ class VideoTest extends BaseTest
|
||||||
* Test getAudioStream function with a DASH URL.
|
* Test getAudioStream function with a DASH URL.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamDashError()
|
public function testGetAudioStreamDashError()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video('https://vimeo.com/251997032', 'bestaudio/best');
|
$video = new Video('https://vimeo.com/251997032', 'bestaudio/best');
|
||||||
$video->getAudioStream();
|
$video->getAudioStream();
|
||||||
}
|
}
|
||||||
|
@ -349,10 +344,10 @@ class VideoTest extends BaseTest
|
||||||
* Test getAudioStream function with a playlist.
|
* Test getAudioStream function with a playlist.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamPlaylistError()
|
public function testGetAudioStreamPlaylistError()
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video(
|
$video = new Video(
|
||||||
'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC',
|
'https://www.youtube.com/playlist?list=PLgdySZU6KUXL_8Jq5aUkyNV7wCa-4wZsC',
|
||||||
'best'
|
'best'
|
||||||
|
@ -369,7 +364,7 @@ class VideoTest extends BaseTest
|
||||||
*/
|
*/
|
||||||
private function assertStream($stream)
|
private function assertStream($stream)
|
||||||
{
|
{
|
||||||
$this->assertInternalType('resource', $stream);
|
$this->assertIsResource($stream);
|
||||||
$this->assertFalse(feof($stream));
|
$this->assertFalse(feof($stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,10 +406,10 @@ class VideoTest extends BaseTest
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @dataProvider urlProvider
|
* @dataProvider urlProvider
|
||||||
* @expectedException Exception
|
|
||||||
*/
|
*/
|
||||||
public function testGetRemuxStreamWithWrongVideo($url, $format)
|
public function testGetRemuxStreamWithWrongVideo($url, $format)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video($url, $format);
|
$video = new Video($url, $format);
|
||||||
$video->getRemuxStream();
|
$video->getRemuxStream();
|
||||||
}
|
}
|
||||||
|
@ -444,11 +439,11 @@ class VideoTest extends BaseTest
|
||||||
* @param string $format Format
|
* @param string $format Format
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
* @dataProvider m3uUrlProvider
|
* @dataProvider m3uUrlProvider
|
||||||
*/
|
*/
|
||||||
public function testGetM3uStreamAvconvError($url, $format)
|
public function testGetM3uStreamAvconvError($url, $format)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
Config::setOptions(['avconv' => 'foobar']);
|
Config::setOptions(['avconv' => 'foobar']);
|
||||||
|
|
||||||
$video = new Video($url, $format);
|
$video = new Video($url, $format);
|
||||||
|
@ -477,11 +472,11 @@ class VideoTest extends BaseTest
|
||||||
* @param string $format Format
|
* @param string $format Format
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
* @expectedException Exception
|
|
||||||
* @dataProvider m3uUrlProvider
|
* @dataProvider m3uUrlProvider
|
||||||
*/
|
*/
|
||||||
public function testGetConvertedStreamM3uError($url, $format)
|
public function testGetConvertedStreamM3uError($url, $format)
|
||||||
{
|
{
|
||||||
|
$this->expectException(Exception::class);
|
||||||
$video = new Video($url, $format);
|
$video = new Video($url, $format);
|
||||||
$video->getConvertedStream(32, 'flv');
|
$video->getConvertedStream(32, 'flv');
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ class YoutubeChunkStreamTest extends StreamTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ class YoutubeStreamTest extends StreamTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp();
|
parent::setUp();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue