mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Final renaming
Upd <extends> tests
This commit is contained in:
56
tests/cases/Cytro/RenderTest.php
Normal file
56
tests/cases/Cytro/RenderTest.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
namespace Cytro;
|
||||
use Cytro,
|
||||
Cytro\Render;
|
||||
|
||||
class RenderTest extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
/**
|
||||
* @var Render
|
||||
*/
|
||||
public static $render;
|
||||
|
||||
public static function setUpBeforeClass() {
|
||||
self::$render = new Render(Cytro::factory("."), function ($tpl) {
|
||||
echo "It is render's function ".$tpl["render"];
|
||||
}, array(
|
||||
"name" => "render.tpl"
|
||||
));
|
||||
}
|
||||
|
||||
public function testCreate() {
|
||||
$r = new Render(Cytro::factory("."), function () {
|
||||
echo "Test render";
|
||||
}, array(
|
||||
"name" => "test.render.tpl"
|
||||
));
|
||||
$this->assertSame("Test render", $r->fetch(array()));
|
||||
}
|
||||
|
||||
public function testDisplay() {
|
||||
ob_start();
|
||||
self::$render->display(array("render" => "display"));
|
||||
$out = ob_get_clean();
|
||||
$this->assertSame("It is render's function display", $out);
|
||||
}
|
||||
|
||||
public function testFetch() {
|
||||
$this->assertSame("It is render's function fetch", self::$render->fetch(array("render" => "fetch")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \RuntimeException
|
||||
* @expectedExceptionMessage template error
|
||||
*/
|
||||
public function testFetchException() {
|
||||
$render = new Render(Cytro::factory("."), function () {
|
||||
echo "error";
|
||||
throw new \RuntimeException("template error");
|
||||
}, array(
|
||||
"name" => "render.tpl"
|
||||
));
|
||||
$render->fetch(array());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user