Refactor stream tests
This commit is contained in:
parent
a5252393de
commit
db5f653e2d
1 changed files with 24 additions and 11 deletions
|
@ -398,6 +398,19 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
$this->download->getAudioStream($url, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that a stream is valid
|
||||
*
|
||||
* @param resource $stream Stream
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function assertStream($stream)
|
||||
{
|
||||
$this->assertInternalType('resource', $stream);
|
||||
$this->assertFalse(feof($stream));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getM3uStream function.
|
||||
*
|
||||
|
@ -409,10 +422,11 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testGetM3uStream($url, $format)
|
||||
{
|
||||
$video = $this->download->getJSON($url, $format);
|
||||
$stream = $this->download->getM3uStream($video);
|
||||
$this->assertInternalType('resource', $stream);
|
||||
$this->assertFalse(feof($stream));
|
||||
$this->assertStream(
|
||||
$this->download->getM3uStream(
|
||||
$this->download->getJSON($url, $format)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -428,9 +442,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$urls = $this->download->getURL($url, $format);
|
||||
if (count($urls) > 1) {
|
||||
$stream = $this->download->getRemuxStream($urls);
|
||||
$this->assertInternalType('resource', $stream);
|
||||
$this->assertFalse(feof($stream));
|
||||
$this->assertStream($this->download->getRemuxStream($urls));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -445,10 +457,11 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testGetRtmpStream($url, $format)
|
||||
{
|
||||
$video = $this->download->getJSON($url, $format);
|
||||
$stream = $this->download->getRtmpStream($video);
|
||||
$this->assertInternalType('resource', $stream);
|
||||
$this->assertFalse(feof($stream));
|
||||
$this->assertStream(
|
||||
$this->download->getRtmpStream(
|
||||
$this->download->getJSON($url, $format)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue