Add test for TemplateHelper::render

This commit is contained in:
filp
2013-06-24 23:53:45 +01:00
parent e83780c2ec
commit a03fbc6bf0
2 changed files with 20 additions and 0 deletions
+17
View File
@@ -58,4 +58,21 @@ class TemplateHelperTest extends TestCase
$this->assertEquals("hello-world", $this->helper->slug("Hello, world!"));
$this->assertEquals("potato-class", $this->helper->slug("Potato class"));
}
/**
* @covers Whoops\Util\TemplateHelper::render
*/
public function testRender()
{
$template = __DIR__ . "/../../fixtures/template.php";
ob_start();
$this->helper->render($template, array("name" => "B<o>b"));
$output = ob_get_clean();
$this->assertEquals(
$output,
"hello-world\nMy name is B&lt;o&gt;b"
);
}
}
+3
View File
@@ -0,0 +1,3 @@
<?php echo $tpl->slug("hello world!"); ?>
My name is <?php echo $tpl->escape($name) ?>