Use separate config file for tests

This commit is contained in:
Pierre Rudloff 2016-08-19 01:07:51 +02:00
parent 78787512ab
commit 1400f3e86a
3 changed files with 28 additions and 12 deletions

View file

@ -12,21 +12,34 @@ use Alltube\Config;
class ConfigTest extends \PHPUnit_Framework_TestCase
{
private $config;
protected function setUp()
{
$this->config = Config::getInstance(__DIR__.'/../config_test.yml');
}
/**
* Test the getInstance function
*
* @return void
*/
public function testGetInstance()
{
$this->assertEquals($this->config->convert, false);
$this->assertInternalType('array', $this->config->curl_params);
$this->assertInternalType('array', $this->config->params);
$this->assertInternalType('string', $this->config->youtubedl);
$this->assertInternalType('string', $this->config->python);
$this->assertInternalType('string', $this->config->avconv);
$this->assertInternalType('string', $this->config->rtmpdump);
}
public function testGetInstanceWithEnv()
{
putenv('CONVERT=1');
$config = Config::getInstance();
Config::destroyInstance();
$config = Config::getInstance(__DIR__.'/../config_test.yml');
$this->assertEquals($config->convert, true);
$this->assertInternalType('array', $config->curl_params);
$this->assertInternalType('array', $config->params);
$this->assertInternalType('string', $config->youtubedl);
$this->assertInternalType('string', $config->python);
$this->assertInternalType('string', $config->avconv);
$this->assertInternalType('string', $config->rtmpdump);
}
}