alltube/tests/ViewFactoryTest.php
Pierre Rudloff 4c9af8ad1d refactor: New Video class
The news class provides a cleaner object-oriented logic

BREAKING CHANGE: The VideoDownload class has been removed and the Config constructor is now private
2019-04-21 18:30:02 +02:00

42 lines
949 B
PHP

<?php
/**
* ViewFactoryTest class.
*/
namespace Alltube\Test;
use Alltube\ViewFactory;
use PHPUnit\Framework\TestCase;
use Slim\Container;
use Slim\Http\Environment;
use Slim\Http\Request;
use Slim\Views\Smarty;
/**
* Unit tests for the ViewFactory class.
*/
class ViewFactoryTest extends BaseTest
{
/**
* Test the create() function.
*
* @return void
*/
public function testCreate()
{
$view = ViewFactory::create(new Container());
$this->assertInstanceOf(Smarty::class, $view);
}
/**
* Test the create() function with a X-Forwarded-Proto header.
*
* @return void
*/
public function testCreateWithXForwardedProto()
{
$request = Request::createFromEnvironment(Environment::mock());
$view = ViewFactory::create(new Container(), $request->withHeader('X-Forwarded-Proto', 'https'));
$this->assertInstanceOf(Smarty::class, $view);
}
}