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

View File

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