Fix FrontController tests
This commit is contained in:
parent
4aba4d5bfd
commit
419110f764
2 changed files with 5 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
{locale path="../i18n" domain="Alltube"}
|
{locale path="../i18n" domain="Alltube"}
|
||||||
<!Doctype HTML>
|
<!Doctype HTML>
|
||||||
<html lang="{$locale->getBcp47()}">
|
<html {if isset($locale)}lang="{$locale->getBcp47()}"{/if}>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name=viewport content="width=device-width, initial-scale=1">
|
<meta name=viewport content="width=device-width, initial-scale=1">
|
||||||
|
|
|
@ -7,6 +7,7 @@ namespace Alltube\Test;
|
||||||
|
|
||||||
use Alltube\Config;
|
use Alltube\Config;
|
||||||
use Alltube\Controller\FrontController;
|
use Alltube\Controller\FrontController;
|
||||||
|
use Alltube\LocaleManager;
|
||||||
use Alltube\ViewFactory;
|
use Alltube\ViewFactory;
|
||||||
use Slim\Container;
|
use Slim\Container;
|
||||||
use Slim\Http\Environment;
|
use Slim\Http\Environment;
|
||||||
|
@ -55,6 +56,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
$this->request = Request::createFromEnvironment(Environment::mock());
|
$this->request = Request::createFromEnvironment(Environment::mock());
|
||||||
$this->response = new Response();
|
$this->response = new Response();
|
||||||
$this->container['view'] = ViewFactory::create($this->container, $this->request);
|
$this->container['view'] = ViewFactory::create($this->container, $this->request);
|
||||||
|
$this->container['locale'] = new LocaleManager();
|
||||||
$this->controller = new FrontController($this->container, Config::getInstance('config/config_test.yml'));
|
$this->controller = new FrontController($this->container, Config::getInstance('config/config_test.yml'));
|
||||||
$this->container['router']->map(['GET'], '/', [$this->controller, 'index'])
|
$this->container['router']->map(['GET'], '/', [$this->controller, 'index'])
|
||||||
->setName('index');
|
->setName('index');
|
||||||
|
@ -64,6 +66,8 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase
|
||||||
->setName('extractors');
|
->setName('extractors');
|
||||||
$this->container['router']->map(['GET'], '/redirect', [$this->controller, 'redirect'])
|
$this->container['router']->map(['GET'], '/redirect', [$this->controller, 'redirect'])
|
||||||
->setName('redirect');
|
->setName('redirect');
|
||||||
|
$this->container['router']->map(['GET'], '/locale', [$this->controller, 'locale'])
|
||||||
|
->setName('locale');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue