Refactored Form.
This commit is contained in:
parent
1fdf9a7ab1
commit
cfe93434ad
45 changed files with 58 additions and 83 deletions
39
tests/PHPCensor/ViewTest.php
Executable file
39
tests/PHPCensor/ViewTest.php
Executable 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', __DIR__ . '/data/view/');
|
||||
self::assertTrue($view->render() == 'Hello');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Exception
|
||||
*/
|
||||
public function testInvalidView()
|
||||
{
|
||||
new View('dogs', __DIR__ . '/data/view/');
|
||||
}
|
||||
|
||||
public function testViewVars()
|
||||
{
|
||||
$view = new View('vars', __DIR__ . '/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');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue