Fix ControllerTest

This commit is contained in:
Pierre Rudloff 2020-07-15 23:23:14 +02:00
parent b6b4dad2ec
commit 2aac009a1e
4 changed files with 15 additions and 7 deletions

View File

@ -6,13 +6,16 @@
namespace Alltube\Test;
use Alltube\Config;
use Alltube\ConfigFactory;
use Alltube\Controller\BaseController;
use Alltube\Controller\DownloadController;
use Alltube\Controller\FrontController;
use Alltube\Exception\ConfigException;
use Alltube\LocaleManager;
use Alltube\LoggerFactory;
use Alltube\Exception\DependencyException;
use Alltube\LocaleManagerFactory;
use Alltube\ViewFactory;
use Psr\Log\NullLogger;
use Slim\Container;
use Slim\Http\Environment;
use Slim\Http\Request;
@ -54,6 +57,7 @@ abstract class ControllerTest extends BaseTest
/**
* Prepare tests.
* @throws ConfigException|SmartyException
* @throws DependencyException
*/
protected function setUp(): void
{
@ -62,9 +66,10 @@ abstract class ControllerTest extends BaseTest
$this->container = new Container();
$this->request = Request::createFromEnvironment(Environment::mock());
$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['logger'] = LoggerFactory::create();
$this->container['logger'] = new NullLogger();
$frontController = new FrontController($this->container);
$downloadController = new DownloadController($this->container);

View File

@ -9,6 +9,7 @@ namespace Alltube\Test;
use Alltube\Config;
use Alltube\Controller\DownloadController;
use Alltube\Exception\ConfigException;
use Alltube\Exception\DependencyException;
use Alltube\Library\Exception\EmptyUrlException;
use Alltube\Library\Exception\RemuxException;
use Alltube\Library\Exception\YoutubedlException;
@ -22,7 +23,7 @@ class DownloadControllerTest extends ControllerTest
{
/**
* Prepare tests.
* @throws ConfigException|SmartyException
* @throws ConfigException|SmartyException|DependencyException
*/
protected function setUp(): void
{

View File

@ -9,6 +9,7 @@ namespace Alltube\Test;
use Alltube\Config;
use Alltube\Controller\FrontController;
use Alltube\Exception\ConfigException;
use Alltube\Exception\DependencyException;
use Alltube\Library\Exception\AlltubeLibraryException;
use Exception;
use Slim\Http\Environment;
@ -28,7 +29,7 @@ class FrontControllerTest extends ControllerTest
/**
* Prepare tests.
* @throws ConfigException|SmartyException
* @throws ConfigException|SmartyException|DependencyException
*/
protected function setUp(): void
{

View File

@ -8,6 +8,7 @@ namespace Alltube\Test;
use Alltube\Controller\JsonController;
use Alltube\Exception\ConfigException;
use Alltube\Exception\DependencyException;
use Alltube\Library\Exception\YoutubedlException;
use SmartyException;
@ -18,7 +19,7 @@ class JsonControllerTest extends ControllerTest
{
/**
* Prepare tests.
* @throws ConfigException|SmartyException
* @throws ConfigException|SmartyException|DependencyException
*/
protected function setUp(): void
{