Update Template.php

Update Template.php

added test case
This commit is contained in:
David Cramer 2014-11-16 14:47:25 +02:00
parent 86a388058f
commit 666e44beb5
2 changed files with 5 additions and 0 deletions

View File

@ -581,6 +581,9 @@ class Template
{
$name = $current[Tokenizer::NAME];
$value = $context->get($name);
if (is_array($value)) {
return 'Array';
}
if ($escaped) {
$args = $this->handlebars->getEscapeArgs();
array_unshift($args, $value);

View File

@ -711,6 +711,8 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('var-y-z', $engine->render('{{var.y.z}}', array('var' => $var)));
// Access parent context in with helper
$this->assertEquals('var-x', $engine->render('{{#with var.y}}{{../var.x}}{{/with}}', array('var' => $var)));
// Reference array as string
$this->assertEquals('Array', $engine->render('{{var}}', array('var' => array('test'))));
$obj = new DateTime();
$time = $obj->getTimestamp();