Refactored project structure.

This commit is contained in:
Dmitry Khomutov 2018-03-04 18:04:15 +07:00
commit c015d8c58b
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
308 changed files with 39 additions and 47 deletions

39
tests/src/ViewTest.php Executable file
View file

@ -0,0 +1,39 @@
<?php
namespace Tests\PHPCensor;
use PHPCensor\View;
class ViewTest extends \PHPUnit\Framework\TestCase
{
public function testSimpleView()
{
$view = new View('simple', ROOT_DIR . 'tests/data/View/');
self::assertTrue($view->render() == 'Hello');
}
/**
* @expectedException \Exception
*/
public function testInvalidView()
{
new View('dogs', ROOT_DIR . 'tests/data/View/');
}
public function testViewVars()
{
$view = new View('vars', ROOT_DIR . 'tests/data/View/');
$view->who = 'World';
self::assertTrue(isset($view->who));
self::assertFalse(isset($view->what));
self::assertTrue($view->render() == 'Hello World');
}
public function testUserViewVars()
{
$view = new View('{@content}');
$view->content = 'World';
self::assertTrue($view->render() == 'World');
}
}