alltube/tests/ViewFactoryTest.php

45 lines
932 B
PHP
Raw Normal View History

2017-04-26 00:59:30 +02:00
<?php
2017-04-26 00:59:30 +02:00
/**
* ViewFactoryTest class.
*/
namespace Alltube\Test;
2020-10-20 23:29:50 +02:00
use Alltube\Factory\ViewFactory;
2017-04-26 00:59:30 +02:00
use Slim\Views\Smarty;
2020-05-13 21:33:05 +02:00
use SmartyException;
2017-04-26 00:59:30 +02:00
/**
* Unit tests for the ViewFactory class.
*/
class ViewFactoryTest extends ContainerTest
2017-04-26 00:59:30 +02:00
{
/**
* Test the create() function.
*
* @return void
2020-05-13 21:33:05 +02:00
* @throws SmartyException
2017-04-26 00:59:30 +02:00
*/
public function testCreate()
{
$view = ViewFactory::create($this->container);
2017-04-26 00:59:30 +02:00
$this->assertInstanceOf(Smarty::class, $view);
}
/**
* Test the create() function with a X-Forwarded-Proto header.
*
* @return void
2020-05-13 21:33:05 +02:00
* @throws SmartyException
*/
public function testCreateWithXForwardedProto()
{
$view = ViewFactory::create(
$this->container,
$this->container->get('request')->withHeader('X-Forwarded-Proto', 'https')
);
$this->assertInstanceOf(Smarty::class, $view);
}
2017-04-26 00:59:30 +02:00
}