Fix ControllerTest
This commit is contained in:
parent
b6b4dad2ec
commit
2aac009a1e
4 changed files with 15 additions and 7 deletions
|
@ -6,13 +6,16 @@
|
||||||
|
|
||||||
namespace Alltube\Test;
|
namespace Alltube\Test;
|
||||||
|
|
||||||
|
use Alltube\Config;
|
||||||
|
use Alltube\ConfigFactory;
|
||||||
use Alltube\Controller\BaseController;
|
use Alltube\Controller\BaseController;
|
||||||
use Alltube\Controller\DownloadController;
|
use Alltube\Controller\DownloadController;
|
||||||
use Alltube\Controller\FrontController;
|
use Alltube\Controller\FrontController;
|
||||||
use Alltube\Exception\ConfigException;
|
use Alltube\Exception\ConfigException;
|
||||||
use Alltube\LocaleManager;
|
use Alltube\Exception\DependencyException;
|
||||||
use Alltube\LoggerFactory;
|
use Alltube\LocaleManagerFactory;
|
||||||
use Alltube\ViewFactory;
|
use Alltube\ViewFactory;
|
||||||
|
use Psr\Log\NullLogger;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
use Slim\Http\Request;
|
use Slim\Http\Request;
|
||||||
|
@ -54,6 +57,7 @@ abstract class ControllerTest extends BaseTest
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
* @throws ConfigException|SmartyException
|
* @throws ConfigException|SmartyException
|
||||||
|
* @throws DependencyException
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
@ -62,9 +66,10 @@ abstract class ControllerTest extends BaseTest
|
||||||
$this->container = new Container();
|
$this->container = new Container();
|
||||||
$this->request = Request::createFromEnvironment(Environment::mock());
|
$this->request = Request::createFromEnvironment(Environment::mock());
|
||||||
$this->response = new Response();
|
$this->response = new Response();
|
||||||
$this->container['locale'] = LocaleManager::getInstance();
|
$this->container['config'] = Config::getInstance();
|
||||||
|
$this->container['locale'] = LocaleManagerFactory::create();
|
||||||
$this->container['view'] = ViewFactory::create($this->container, $this->request);
|
$this->container['view'] = ViewFactory::create($this->container, $this->request);
|
||||||
$this->container['logger'] = LoggerFactory::create();
|
$this->container['logger'] = new NullLogger();
|
||||||
|
|
||||||
$frontController = new FrontController($this->container);
|
$frontController = new FrontController($this->container);
|
||||||
$downloadController = new DownloadController($this->container);
|
$downloadController = new DownloadController($this->container);
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Alltube\Test;
|
||||||
use Alltube\Config;
|
use Alltube\Config;
|
||||||
use Alltube\Controller\DownloadController;
|
use Alltube\Controller\DownloadController;
|
||||||
use Alltube\Exception\ConfigException;
|
use Alltube\Exception\ConfigException;
|
||||||
|
use Alltube\Exception\DependencyException;
|
||||||
use Alltube\Library\Exception\EmptyUrlException;
|
use Alltube\Library\Exception\EmptyUrlException;
|
||||||
use Alltube\Library\Exception\RemuxException;
|
use Alltube\Library\Exception\RemuxException;
|
||||||
use Alltube\Library\Exception\YoutubedlException;
|
use Alltube\Library\Exception\YoutubedlException;
|
||||||
|
@ -22,7 +23,7 @@ class DownloadControllerTest extends ControllerTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
* @throws ConfigException|SmartyException
|
* @throws ConfigException|SmartyException|DependencyException
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -9,6 +9,7 @@ namespace Alltube\Test;
|
||||||
use Alltube\Config;
|
use Alltube\Config;
|
||||||
use Alltube\Controller\FrontController;
|
use Alltube\Controller\FrontController;
|
||||||
use Alltube\Exception\ConfigException;
|
use Alltube\Exception\ConfigException;
|
||||||
|
use Alltube\Exception\DependencyException;
|
||||||
use Alltube\Library\Exception\AlltubeLibraryException;
|
use Alltube\Library\Exception\AlltubeLibraryException;
|
||||||
use Exception;
|
use Exception;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
|
@ -28,7 +29,7 @@ class FrontControllerTest extends ControllerTest
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
* @throws ConfigException|SmartyException
|
* @throws ConfigException|SmartyException|DependencyException
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
|
@ -8,6 +8,7 @@ namespace Alltube\Test;
|
||||||
|
|
||||||
use Alltube\Controller\JsonController;
|
use Alltube\Controller\JsonController;
|
||||||
use Alltube\Exception\ConfigException;
|
use Alltube\Exception\ConfigException;
|
||||||
|
use Alltube\Exception\DependencyException;
|
||||||
use Alltube\Library\Exception\YoutubedlException;
|
use Alltube\Library\Exception\YoutubedlException;
|
||||||
use SmartyException;
|
use SmartyException;
|
||||||
|
|
||||||
|
@ -18,7 +19,7 @@ class JsonControllerTest extends ControllerTest
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Prepare tests.
|
* Prepare tests.
|
||||||
* @throws ConfigException|SmartyException
|
* @throws ConfigException|SmartyException|DependencyException
|
||||||
*/
|
*/
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue