This commit is contained in:
Pierre Rudloff 2020-09-27 19:56:19 +02:00
parent 4bd121cda2
commit f9aab3c404
2 changed files with 28 additions and 27 deletions

View file

@ -7,7 +7,6 @@
namespace Alltube\Test; namespace Alltube\Test;
use Alltube\Config; use Alltube\Config;
use Alltube\ConfigFactory;
use Alltube\Controller\BaseController; use Alltube\Controller\BaseController;
use Alltube\Controller\DownloadController; use Alltube\Controller\DownloadController;
use Alltube\Controller\FrontController; use Alltube\Controller\FrontController;
@ -94,7 +93,7 @@ abstract class ControllerTest extends BaseTest
* *
* @return Response HTTP response * @return Response HTTP response
*/ */
protected function getRequestResult($request, array $params) protected function getRequestResult(string $request, array $params)
{ {
return $this->controller->$request( return $this->controller->$request(
$this->request->withQueryParams($params), $this->request->withQueryParams($params),
@ -110,7 +109,7 @@ abstract class ControllerTest extends BaseTest
* *
* @return void * @return void
*/ */
protected function assertRequestIsOk($request, array $params = []) protected function assertRequestIsOk(string $request, array $params = [])
{ {
$this->assertTrue($this->getRequestResult($request, $params)->isOk()); $this->assertTrue($this->getRequestResult($request, $params)->isOk());
} }
@ -123,7 +122,7 @@ abstract class ControllerTest extends BaseTest
* *
* @return void * @return void
*/ */
protected function assertRequestIsRedirect($request, array $params = []) protected function assertRequestIsRedirect(string $request, array $params = [])
{ {
$this->assertTrue($this->getRequestResult($request, $params)->isRedirect()); $this->assertTrue($this->getRequestResult($request, $params)->isRedirect());
} }
@ -136,7 +135,7 @@ abstract class ControllerTest extends BaseTest
* *
* @return void * @return void
*/ */
protected function assertRequestIsServerError($request, array $params = []) protected function assertRequestIsServerError(string $request, array $params = [])
{ {
$this->assertTrue($this->getRequestResult($request, $params)->isServerError()); $this->assertTrue($this->getRequestResult($request, $params)->isServerError());
} }
@ -149,7 +148,7 @@ abstract class ControllerTest extends BaseTest
* *
* @return void * @return void
*/ */
protected function assertRequestIsClientError($request, array $params = []) protected function assertRequestIsClientError(string $request, array $params = [])
{ {
$this->assertTrue($this->getRequestResult($request, $params)->isClientError()); $this->assertTrue($this->getRequestResult($request, $params)->isClientError());
} }

View file

@ -141,7 +141,7 @@ class VideoTest extends BaseTest
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider ErrorUrlProvider * @dataProvider ErrorUrlProvider
*/ */
public function testgetUrlError($url) public function testgetUrlError(string $url)
{ {
$this->expectException(YoutubedlException::class); $this->expectException(YoutubedlException::class);
$video = new Video($this->downloader, $url, $this->format); $video = new Video($this->downloader, $url, $this->format);
@ -258,7 +258,7 @@ class VideoTest extends BaseTest
* @dataProvider urlProvider * @dataProvider urlProvider
* @dataProvider m3uUrlProvider * @dataProvider m3uUrlProvider
*/ */
public function testGetJson($url, $format) public function testGetJson(string $url, string $format)
{ {
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
$info = $video->getJson(); $info = $video->getJson();
@ -279,7 +279,7 @@ class VideoTest extends BaseTest
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider ErrorURLProvider * @dataProvider ErrorURLProvider
*/ */
public function testGetJsonError($url) public function testGetJsonError(string $url)
{ {
$this->expectException(YoutubedlException::class); $this->expectException(YoutubedlException::class);
$video = new Video($this->downloader, $url, $this->format); $video = new Video($this->downloader, $url, $this->format);
@ -300,7 +300,7 @@ class VideoTest extends BaseTest
* @dataProvider m3uUrlProvider * @dataProvider m3uUrlProvider
* @dataProvider remuxUrlProvider * @dataProvider remuxUrlProvider
*/ */
public function testGetFilename($url, $format, $filename, $extension) public function testGetFilename(string $url, string $format, string $filename, string $extension)
{ {
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
$this->assertEquals($video->getFilename(), $filename . '.' . $extension); $this->assertEquals($video->getFilename(), $filename . '.' . $extension);
@ -315,7 +315,7 @@ class VideoTest extends BaseTest
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider ErrorUrlProvider * @dataProvider ErrorUrlProvider
*/ */
public function testGetFilenameError($url) public function testGetFilenameError(string $url)
{ {
$this->expectException(YoutubedlException::class); $this->expectException(YoutubedlException::class);
$video = new Video($this->downloader, $url, $this->format); $video = new Video($this->downloader, $url, $this->format);
@ -329,10 +329,10 @@ class VideoTest extends BaseTest
* @param string $format Format * @param string $format Format
* *
* @return void * @return void
* @dataProvider urlProvider
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider urlProvider
*/ */
public function testGetAudioStream($url, $format) public function testGetAudioStream(string $url, string $format)
{ {
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
$this->assertStream($this->downloader->getAudioStream($video)); $this->assertStream($this->downloader->getAudioStream($video));
@ -345,10 +345,11 @@ class VideoTest extends BaseTest
* @param string $format Format * @param string $format Format
* *
* @return void * @return void
* @throws AlltubeLibraryException|ConfigException * @throws AlltubeLibraryException
* @throws ConfigException
* @dataProvider urlProvider * @dataProvider urlProvider
*/ */
public function testGetAudioStreamFfmpegError($url, $format) public function testGetAudioStreamFfmpegError(string $url, string $format)
{ {
$this->expectException(AvconvException::class); $this->expectException(AvconvException::class);
Config::setOptions(['ffmpeg' => 'foobar']); Config::setOptions(['ffmpeg' => 'foobar']);
@ -369,7 +370,7 @@ class VideoTest extends BaseTest
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider m3uUrlProvider * @dataProvider m3uUrlProvider
*/ */
public function testGetAudioStreamM3uError($url, $format) public function testGetAudioStreamM3uError(string $url, string $format)
{ {
$this->expectException(InvalidProtocolConversionException::class); $this->expectException(InvalidProtocolConversionException::class);
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
@ -426,10 +427,10 @@ class VideoTest extends BaseTest
* @param string $format Format * @param string $format Format
* *
* @return void * @return void
* @dataProvider m3uUrlProvider
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider m3uUrlProvider
*/ */
public function testGetM3uStream($url, $format) public function testGetM3uStream(string $url, string $format)
{ {
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
$this->assertStream($this->downloader->getM3uStream($video)); $this->assertStream($this->downloader->getM3uStream($video));
@ -442,10 +443,10 @@ class VideoTest extends BaseTest
* @param string $format Format * @param string $format Format
* *
* @return void * @return void
* @dataProvider remuxUrlProvider
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider remuxUrlProvider
*/ */
public function testGetRemuxStream($url, $format) public function testGetRemuxStream(string $url, string $format)
{ {
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
$this->assertStream($this->downloader->getRemuxStream($video)); $this->assertStream($this->downloader->getRemuxStream($video));
@ -461,7 +462,7 @@ class VideoTest extends BaseTest
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider urlProvider * @dataProvider urlProvider
*/ */
public function testGetRemuxStreamWithWrongVideo($url, $format) public function testGetRemuxStreamWithWrongVideo(string $url, string $format)
{ {
$this->expectException(RemuxException::class); $this->expectException(RemuxException::class);
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
@ -478,7 +479,7 @@ class VideoTest extends BaseTest
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider rtmpUrlProvider * @dataProvider rtmpUrlProvider
*/ */
public function testGetRtmpStream($url, $format) public function testGetRtmpStream(string $url, string $format)
{ {
$this->markTestIncomplete('We need to find another RTMP video.'); $this->markTestIncomplete('We need to find another RTMP video.');
@ -494,10 +495,11 @@ class VideoTest extends BaseTest
* @param string $format Format * @param string $format Format
* *
* @return void * @return void
* @throws AlltubeLibraryException|ConfigException * @throws AlltubeLibraryException
* @throws ConfigException
* @dataProvider m3uUrlProvider * @dataProvider m3uUrlProvider
*/ */
public function testGetM3uStreamFfmpegError($url, $format) public function testGetM3uStreamFfmpegError(string $url, string $format)
{ {
$this->expectException(AvconvException::class); $this->expectException(AvconvException::class);
Config::setOptions(['ffmpeg' => 'foobar']); Config::setOptions(['ffmpeg' => 'foobar']);
@ -515,10 +517,10 @@ class VideoTest extends BaseTest
* @param string $format Format * @param string $format Format
* *
* @return void * @return void
* @dataProvider urlProvider
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider urlProvider
*/ */
public function testGetConvertedStream($url, $format) public function testGetConvertedStream(string $url, string $format)
{ {
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);
$this->assertStream($this->downloader->getConvertedStream($video, 32, 'flv')); $this->assertStream($this->downloader->getConvertedStream($video, 32, 'flv'));
@ -534,7 +536,7 @@ class VideoTest extends BaseTest
* @throws AlltubeLibraryException * @throws AlltubeLibraryException
* @dataProvider m3uUrlProvider * @dataProvider m3uUrlProvider
*/ */
public function testGetConvertedStreamM3uError($url, $format) public function testGetConvertedStreamM3uError(string $url, string $format)
{ {
$this->expectException(InvalidProtocolConversionException::class); $this->expectException(InvalidProtocolConversionException::class);
$video = new Video($this->downloader, $url, $format); $video = new Video($this->downloader, $url, $format);