Merge pull request #163 from mAAdhaTTah/bugfix/mustache-compatibility

Add failing test for Mustache-style `if` blocks
This commit is contained in:
Behrooz Shabani 2016-12-12 14:51:02 +01:00 committed by GitHub
commit b85cee07ea
2 changed files with 7 additions and 0 deletions

View File

@ -87,6 +87,8 @@ class Parser
if (!array_key_exists(Tokenizer::NODES, $result)
&& isset($result[Tokenizer::NAME])
&& ($result[Tokenizer::TYPE] == Tokenizer::T_SECTION
|| $result[Tokenizer::TYPE] == Tokenizer::T_INVERTED)
&& $result[Tokenizer::NAME] == $token[Tokenizer::NAME]
) {
if (isset($result[Tokenizer::TRIM_RIGHT])

View File

@ -177,6 +177,11 @@ class HandlebarsTest extends \PHPUnit_Framework_TestCase
array('first' => false, 'second' => true),
'The second'
),
array(
'{{#value}}Hello {{value}}, from {{parent_context}}{{/value}}',
array('value' => 'string', 'parent_context' => 'parent string'),
'Hello string, from parent string'
),
);
}