Test for exceptions when creating config
This commit is contained in:
parent
201d7c3376
commit
85fb3a54cd
2 changed files with 39 additions and 1 deletions
|
@ -42,6 +42,17 @@ class ConfigTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->assertInternalType('string', $this->config->rtmpdump);
|
$this->assertInternalType('string', $this->config->rtmpdump);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test the getInstance function with a missing config file.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @expectedException Exception
|
||||||
|
*/
|
||||||
|
public function testGetInstanceWithMissingFile()
|
||||||
|
{
|
||||||
|
Config::getInstance('foo');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the getInstance function with the CONVERT environment variable.
|
* Test the getInstance function with the CONVERT environment variable.
|
||||||
*
|
*
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
namespace Alltube\Test;
|
namespace Alltube\Test;
|
||||||
|
|
||||||
use Alltube\VideoDownload;
|
use Alltube\VideoDownload;
|
||||||
|
use Alltube\Config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit tests for the VideoDownload class.
|
* Unit tests for the VideoDownload class.
|
||||||
|
@ -31,7 +32,33 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
protected function tearDown()
|
protected function tearDown()
|
||||||
{
|
{
|
||||||
\Alltube\Config::destroyInstance();
|
Config::destroyInstance();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test VideoDownload constructor with wrong youtube-dl path.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @expectedException Exception
|
||||||
|
*/
|
||||||
|
public function testConstructorWithMissingYoutubedl()
|
||||||
|
{
|
||||||
|
new VideoDownload(
|
||||||
|
new Config(['youtubedl'=>'foo'])
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test VideoDownload constructor with wrong Python path.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
* @expectedException Exception
|
||||||
|
*/
|
||||||
|
public function testConstructorWithMissingPython()
|
||||||
|
{
|
||||||
|
new VideoDownload(
|
||||||
|
new Config(['python'=>'foo'])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue