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);
|
$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.
|
* Test getM3uStream function.
|
||||||
*
|
*
|
||||||
|
@ -409,10 +422,11 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetM3uStream($url, $format)
|
public function testGetM3uStream($url, $format)
|
||||||
{
|
{
|
||||||
$video = $this->download->getJSON($url, $format);
|
$this->assertStream(
|
||||||
$stream = $this->download->getM3uStream($video);
|
$this->download->getM3uStream(
|
||||||
$this->assertInternalType('resource', $stream);
|
$this->download->getJSON($url, $format)
|
||||||
$this->assertFalse(feof($stream));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -428,9 +442,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
$urls = $this->download->getURL($url, $format);
|
$urls = $this->download->getURL($url, $format);
|
||||||
if (count($urls) > 1) {
|
if (count($urls) > 1) {
|
||||||
$stream = $this->download->getRemuxStream($urls);
|
$this->assertStream($this->download->getRemuxStream($urls));
|
||||||
$this->assertInternalType('resource', $stream);
|
|
||||||
$this->assertFalse(feof($stream));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,10 +457,11 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetRtmpStream($url, $format)
|
public function testGetRtmpStream($url, $format)
|
||||||
{
|
{
|
||||||
$video = $this->download->getJSON($url, $format);
|
$this->assertStream(
|
||||||
$stream = $this->download->getRtmpStream($video);
|
$this->download->getRtmpStream(
|
||||||
$this->assertInternalType('resource', $stream);
|
$this->download->getJSON($url, $format)
|
||||||
$this->assertFalse(feof($stream));
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue