Merge branch 'patch-6' of github.com:ulriklystbaek/handlebars.php

Conflicts:
	tests/Xamin/HandlebarsTest.php
This commit is contained in:
fzerorubigd 2014-08-29 11:08:36 +04:30
commit d731f8d438
No known key found for this signature in database
GPG Key ID: D6EE858AF9D2999A

View File

@ -952,4 +952,16 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals("'(test)'Test.", $engine->render("{{test '(test)'}}", array()));
$this->assertEquals("')'Test.Test.", $engine->render("{{test (test ')')}}", array()));
}
}
/**
* 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')));
}
}