alltube/tests/ConfigTest.php

46 lines
1.1 KiB
PHP
Raw Normal View History

2015-10-31 14:42:25 +00:00
<?php
/**
* ConfigTest class
2016-08-01 11:29:13 +00:00
*/
2016-03-29 23:49:08 +00:00
namespace Alltube\Test;
2015-10-31 14:42:25 +00:00
use Alltube\Config;
/**
* Unit tests for the Config class
2016-08-01 11:29:13 +00:00
*/
2016-03-29 23:49:08 +00:00
class ConfigTest extends \PHPUnit_Framework_TestCase
2015-10-31 14:42:25 +00:00
{
2015-10-31 14:50:32 +00:00
2016-08-18 23:07:51 +00:00
private $config;
protected function setUp()
{
$this->config = Config::getInstance(__DIR__.'/../config_test.yml');
}
2015-10-31 14:50:32 +00:00
/**
* Test the getInstance function
2016-02-28 22:04:53 +00:00
*
2015-10-31 14:50:32 +00:00
* @return void
*/
2015-10-31 14:42:25 +00:00
public function testGetInstance()
2016-08-18 23:07:51 +00:00
{
$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()
2015-10-31 14:42:25 +00:00
{
putenv('CONVERT=1');
2016-08-18 23:07:51 +00:00
Config::destroyInstance();
$config = Config::getInstance(__DIR__.'/../config_test.yml');
2015-10-31 14:42:25 +00:00
$this->assertEquals($config->convert, true);
}
}