Update HandlebarsTest.php

Test that check if the if and unless helpers comply with handlebars.js
This commit is contained in:
ulriklystbaek 2014-08-28 18:47:51 +02:00
parent 3710a50e41
commit 4e81464c30

View File

@ -961,4 +961,16 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
$engine = new \Handlebars\Handlebars();
//$engine->set
}
}
/**
* Test if and unless adding an extra layer when accessing parent
*/
public function testIfUnlessExtraLayer()
{
$loader = new \Handlebars\Loader\StringLoader();
$engine = new \Handlebars\Handlebars(array('loader' => $loader));
$this->assertEquals('good', $engine->render('{{#with b}}{{#if this}}{{../../a}}{{/if}}{{/with}}', array('a' => 'good', 'b' => 'stump')));
$this->assertEquals('good', $engine->render('{{#with b}}{{#if unless}}{{else}}{{../../a}}{{/if}}{{/with}}', array('a' => 'good', 'b' => 'stump')));
}
}