New tests
This commit is contained in:
parent
26388ea1b4
commit
e3cec201ee
4 changed files with 92 additions and 6 deletions
|
@ -83,18 +83,22 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
array(
|
||||
'https://www.youtube.com/watch?v=M7IpKCZ47pU', null,
|
||||
"It's Not Me, It's You - Hearts Under Fire-M7IpKCZ47pU.mp4",
|
||||
'googlevideo.com'
|
||||
'googlevideo.com',
|
||||
"It's Not Me, It's You - Hearts Under Fire-M7IpKCZ47pU.mp3"
|
||||
),
|
||||
array(
|
||||
'https://www.youtube.com/watch?v=RJJ6FCAXvKg', 22,
|
||||
"'Heart Attack' - Demi Lovato ".
|
||||
"(Sam Tsui & Against The Current)-RJJ6FCAXvKg.mp4",
|
||||
'googlevideo.com'
|
||||
'googlevideo.com',
|
||||
"'Heart Attack' - Demi Lovato ".
|
||||
"(Sam Tsui & Against The Current)-RJJ6FCAXvKg.mp3"
|
||||
),
|
||||
array(
|
||||
'https://vimeo.com/24195442', null,
|
||||
"Carving the Mountains-24195442.mp4",
|
||||
'vimeocdn.com'
|
||||
'vimeocdn.com',
|
||||
"Carving the Mountains-24195442.mp3"
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -144,4 +148,80 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$videoURL = $this->download->getJSON($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getFilename function
|
||||
*
|
||||
* @param string $url URL
|
||||
* @param string $format Format
|
||||
*
|
||||
* @return void
|
||||
* @dataProvider urlProvider
|
||||
*/
|
||||
public function testGetFilename($url, $format, $filename)
|
||||
{
|
||||
$videoFilename = $this->download->getFilename($url, $format);
|
||||
$this->assertEquals($videoFilename, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getFilename function errors
|
||||
*
|
||||
* @param string $url URL
|
||||
*
|
||||
* @return void
|
||||
* @expectedException Exception
|
||||
* @dataProvider ErrorUrlProvider
|
||||
*/
|
||||
public function testGetFilenameError($url)
|
||||
{
|
||||
$this->download->getFilename($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getAudioFilename function
|
||||
*
|
||||
* @param string $url URL
|
||||
* @param string $format Format
|
||||
*
|
||||
* @return void
|
||||
* @dataProvider urlProvider
|
||||
*/
|
||||
public function testGetAudioFilename($url, $format, $filename, $domain, $audioFilename)
|
||||
{
|
||||
$videoFilename = $this->download->getAudioFilename($url, $format);
|
||||
$this->assertEquals($videoFilename, $audioFilename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getAudioStream function
|
||||
*
|
||||
* @param string $url URL
|
||||
* @param string $format Format
|
||||
*
|
||||
* @return void
|
||||
* @dataProvider urlProvider
|
||||
*/
|
||||
public function testGetAudioStream($url, $format)
|
||||
{
|
||||
$process = $this->download->getAudioStream($url, $format);
|
||||
$this->assertInternalType('resource', $process);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test getAudioStream function
|
||||
*
|
||||
* @param string $url URL
|
||||
* @param string $format Format
|
||||
*
|
||||
* @return void
|
||||
* @expectedException Exception
|
||||
* @dataProvider urlProvider
|
||||
*/
|
||||
public function testGetAudioStreamAvconvError($url, $format)
|
||||
{
|
||||
$config = \Alltube\Config::getInstance();
|
||||
$config->avconv = 'foobar';
|
||||
$this->download->getAudioStream($url, $format);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue