Merge branch 'dev' into feature/higher-order-sections
Conflicts: Mustache.php
This commit is contained in:
+37
-2
@@ -36,7 +36,7 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
|
||||
const TEST_CLASS = 'Mustache';
|
||||
|
||||
protected $knownIssues = array(
|
||||
'Delimiters' => "Known issue: sections don't respect delimiter changes",
|
||||
// Just the whitespace ones...
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -195,6 +195,30 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals('Charlie Chaplin', $m->render(null, array('first_name' => 'Charlie', 'last_name' => 'Chaplin')));
|
||||
$this->assertEquals('Zappa, Frank', $m->render('{{last_name}}, {{first_name}}', array('first_name' => 'Frank', 'last_name' => 'Zappa')));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group interpolation
|
||||
* @dataProvider interpolationData
|
||||
*/
|
||||
public function testDoubleRenderMustacheTags($template, $context, $expected) {
|
||||
$m = new Mustache($template, $context);
|
||||
$this->assertEquals($expected, $m->render());
|
||||
}
|
||||
|
||||
public function interpolationData() {
|
||||
return array(
|
||||
array(
|
||||
'{{#a}}{{=<% %>=}}{{b}} c<%={{ }}=%>{{/a}}',
|
||||
array('a' => array(array('b' => 'Do Not Render'))),
|
||||
'{{b}} c'
|
||||
),
|
||||
array(
|
||||
'{{#a}}{{b}}{{/a}}',
|
||||
array('a' => array('b' => '{{c}}'), 'c' => 'FAIL'),
|
||||
'{{c}}'
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Mustache should allow newlines (and other whitespace) in comments and all other tags.
|
||||
@@ -378,6 +402,17 @@ class MustacheTest extends PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals('success', $m->render('{{=<% %>=}}<% result %>'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group delimiters
|
||||
*/
|
||||
public function testStickyDelimiters() {
|
||||
$m = new Mustache(null, array('result' => 'FAIL'));
|
||||
$this->assertEquals('{{ result }}', $m->render('{{=[[ ]]=}}{{ result }}[[={{ }}=]]'));
|
||||
$this->assertEquals('{{#result}}{{/result}}', $m->render('{{=[[ ]]=}}{{#result}}{{/result}}[[={{ }}=]]'));
|
||||
$this->assertEquals('{{ result }}', $m->render('{{=[[ ]]=}}[[#result]]{{ result }}[[/result]][[={{ }}=]]'));
|
||||
$this->assertEquals('{{ result }}', $m->render('{{#result}}{{=[[ ]]=}}{{ result }}[[/result]][[^result]][[={{ }}=]][[ result ]]{{/result}}'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @group sections
|
||||
* @dataProvider poorlyNestedSections
|
||||
@@ -426,4 +461,4 @@ class MustacheExposedOptionsStub extends Mustache {
|
||||
public function getDelimiters() {
|
||||
return array($this->_otag, $this->_ctag);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user