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();
|
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.
|
* Test the constructor with streams enabled.
|
||||||
*
|
*
|
||||||
|
@ -325,10 +336,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testRedirectWithM3uStream()
|
public function testRedirectWithM3uStream()
|
||||||
{
|
{
|
||||||
$config = Config::getInstance();
|
$controller = new FrontController($this->container, new Config(['stream'=>true]));
|
||||||
$config->stream = true;
|
|
||||||
//We need to create a new controller instance in order to apply the custom config
|
|
||||||
$controller = new FrontController($this->container);
|
|
||||||
$result = $controller->redirect(
|
$result = $controller->redirect(
|
||||||
$this->request->withQueryParams(['url'=>'https://twitter.com/verge/status/813055465324056576/video/1']),
|
$this->request->withQueryParams(['url'=>'https://twitter.com/verge/status/813055465324056576/video/1']),
|
||||||
$this->response
|
$this->response
|
||||||
|
|
|
@ -25,7 +25,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
protected function setUp()
|
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)
|
public function testGetAudioStreamAvconvError($url, $format)
|
||||||
{
|
{
|
||||||
$config = Config::getInstance();
|
$download = new VideoDownload(new Config(['avconv'=>'foobar']));
|
||||||
$config->avconv = 'foobar';
|
$download->getAudioStream($url, $format);
|
||||||
$this->download->getAudioStream($url, $format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -338,10 +337,8 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetAudioStreamCurlError($url, $format)
|
public function testGetAudioStreamCurlError($url, $format)
|
||||||
{
|
{
|
||||||
$config = Config::getInstance();
|
$download = new VideoDownload(new Config(['curl'=>'foobar', 'rtmpdump'=>'foobar']));
|
||||||
$config->curl = 'foobar';
|
$download->getAudioStream($url, $format);
|
||||||
$config->rtmpdump = 'foobar';
|
|
||||||
$this->download->getAudioStream($url, $format);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -388,9 +385,8 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase
|
||||||
*/
|
*/
|
||||||
public function testGetM3uStreamAvconvError($url, $format)
|
public function testGetM3uStreamAvconvError($url, $format)
|
||||||
{
|
{
|
||||||
$config = \Alltube\Config::getInstance();
|
$download = new VideoDownload(new Config(['avconv'=>'foobar']));
|
||||||
$config->avconv = 'foobar';
|
$video = $download->getJSON($url, $format);
|
||||||
$video = $this->download->getJSON($url, $format);
|
$download->getM3uStream($video);
|
||||||
$this->download->getM3uStream($video);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue