Use cleaner way to create custom config everywhere
This commit is contained in:
parent
e4f061e6c3
commit
d2ad962f6f
2 changed files with 20 additions and 16 deletions
|
@ -83,6 +83,17 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
|||
Config::destroyInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the constructor.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testConstructor()
|
||||
{
|
||||
$controller = new FrontController($this->container);
|
||||
$this->assertInstanceOf(FrontController::class, $controller);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the constructor with streams enabled.
|
||||
*
|
||||
|
@ -325,10 +336,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testRedirectWithM3uStream()
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
$config->stream = true;
|
||||
//We need to create a new controller instance in order to apply the custom config
|
||||
$controller = new FrontController($this->container);
|
||||
$controller = new FrontController($this->container, new Config(['stream'=>true]));
|
||||
$result = $controller->redirect(
|
||||
$this->request->withQueryParams(['url'=>'https://twitter.com/verge/status/813055465324056576/video/1']),
|
||||
$this->response
|
||||
|
|
|
@ -25,7 +25,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
protected function setUp()
|
||||
{
|
||||
$this->download = new VideoDownload();
|
||||
$this->download = new VideoDownload(Config::getInstance('config_test.yml'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,9 +321,8 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testGetAudioStreamAvconvError($url, $format)
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
$config->avconv = 'foobar';
|
||||
$this->download->getAudioStream($url, $format);
|
||||
$download = new VideoDownload(new Config(['avconv'=>'foobar']));
|
||||
$download->getAudioStream($url, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,10 +337,8 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testGetAudioStreamCurlError($url, $format)
|
||||
{
|
||||
$config = Config::getInstance();
|
||||
$config->curl = 'foobar';
|
||||
$config->rtmpdump = 'foobar';
|
||||
$this->download->getAudioStream($url, $format);
|
||||
$download = new VideoDownload(new Config(['curl'=>'foobar', 'rtmpdump'=>'foobar']));
|
||||
$download->getAudioStream($url, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -388,9 +385,8 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testGetM3uStreamAvconvError($url, $format)
|
||||
{
|
||||
$config = \Alltube\Config::getInstance();
|
||||
$config->avconv = 'foobar';
|
||||
$video = $this->download->getJSON($url, $format);
|
||||
$this->download->getM3uStream($video);
|
||||
$download = new VideoDownload(new Config(['avconv'=>'foobar']));
|
||||
$video = $download->getJSON($url, $format);
|
||||
$download->getM3uStream($video);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue