forked from php-censor/php-censor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewTest.php
More file actions
36 lines (28 loc) · 899 Bytes
/
Copy pathViewTest.php
File metadata and controls
36 lines (28 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
declare(strict_types=1);
namespace Tests\PHPCensor;
use PHPCensor\Common\Exception\RuntimeException;
use PHPCensor\View;
use PHPUnit\Framework\TestCase;
class ViewTest extends TestCase
{
public function testSimpleView(): void
{
$view = new View('simple', ROOT_DIR . 'tests/data/View/');
self::assertTrue($view->render() === 'Hello');
}
public function testInvalidView(): void
{
self::expectException(RuntimeException::class);
new View('dogs', ROOT_DIR . 'tests/data/View/');
}
public function testViewVars(): void
{
$view = new View('vars', ROOT_DIR . 'tests/data/View/');
$view->who = 'World';
self::assertTrue(isset($view->who));
self::assertEquals('World', $view->who);
self::assertFalse(isset($view->what));
self::assertTrue($view->render() === 'Hello World');
}
}