alltube/tests/ViewFactoryTest.php

48 lines
1.1 KiB
PHP
Raw Normal View History

2017-04-25 22:59:30 +00:00
<?php
2017-04-25 22:59:30 +00:00
/**
* ViewFactoryTest class.
*/
namespace Alltube\Test;
2019-11-27 23:04:05 +00:00
use Alltube\LocaleManager;
2017-04-25 22:59:30 +00:00
use Alltube\ViewFactory;
use Slim\Container;
use Slim\Http\Environment;
use Slim\Http\Request;
2017-04-25 22:59:30 +00:00
use Slim\Views\Smarty;
/**
* Unit tests for the ViewFactory class.
*/
class ViewFactoryTest extends BaseTest
2017-04-25 22:59:30 +00:00
{
/**
* Test the create() function.
*
* @return void
*/
public function testCreate()
{
2019-11-27 23:04:05 +00:00
$container = new Container();
$container['locale'] = LocaleManager::getInstance();
$view = ViewFactory::create($container);
2017-04-25 22:59:30 +00:00
$this->assertInstanceOf(Smarty::class, $view);
}
/**
* Test the create() function with a X-Forwarded-Proto header.
*
* @return void
*/
public function testCreateWithXForwardedProto()
{
2019-11-27 23:04:05 +00:00
$container = new Container();
$container['locale'] = LocaleManager::getInstance();
$request = Request::createFromEnvironment(Environment::mock());
2019-11-27 23:04:05 +00:00
$view = ViewFactory::create($container, $request->withHeader('X-Forwarded-Proto', 'https'));
$this->assertInstanceOf(Smarty::class, $view);
}
2017-04-25 22:59:30 +00:00
}