Convert SessionManager to a factory class
This commit is contained in:
parent
5b0ee7651b
commit
de8c5e5dc7
10 changed files with 64 additions and 52 deletions
|
@ -6,8 +6,10 @@
|
|||
|
||||
namespace Alltube\Test;
|
||||
|
||||
use Alltube\Exception\DependencyException;
|
||||
use Alltube\Factory\LocaleManagerFactory;
|
||||
use Alltube\Factory\SessionFactory;
|
||||
use Alltube\Factory\ViewFactory;
|
||||
use Alltube\LocaleManager;
|
||||
use Slim\Container;
|
||||
use Slim\Http\Environment;
|
||||
use Slim\Http\Request;
|
||||
|
@ -24,11 +26,13 @@ class ViewFactoryTest extends BaseTest
|
|||
*
|
||||
* @return void
|
||||
* @throws SmartyException
|
||||
* @throws DependencyException
|
||||
*/
|
||||
public function testCreate()
|
||||
{
|
||||
$container = new Container();
|
||||
$container['locale'] = new LocaleManager();
|
||||
$container['session'] = SessionFactory::create();
|
||||
$container['locale'] = LocaleManagerFactory::create($container);
|
||||
$view = ViewFactory::create($container);
|
||||
$this->assertInstanceOf(Smarty::class, $view);
|
||||
}
|
||||
|
@ -38,11 +42,13 @@ class ViewFactoryTest extends BaseTest
|
|||
*
|
||||
* @return void
|
||||
* @throws SmartyException
|
||||
* @throws DependencyException
|
||||
*/
|
||||
public function testCreateWithXForwardedProto()
|
||||
{
|
||||
$container = new Container();
|
||||
$container['locale'] = new LocaleManager();
|
||||
$container['session'] = SessionFactory::create();
|
||||
$container['locale'] = LocaleManagerFactory::create($container);
|
||||
$request = Request::createFromEnvironment(Environment::mock());
|
||||
$view = ViewFactory::create($container, $request->withHeader('X-Forwarded-Proto', 'https'));
|
||||
$this->assertInstanceOf(Smarty::class, $view);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue