Even more ludicrous recursive section / implicit iterator tests.

This commit is contained in:
Justin Hileman
2010-11-24 04:10:37 -05:00
parent fef6234954
commit d026315a2c
+28 -5
View File
@@ -50,11 +50,34 @@ class MustachePragmaImplicitIteratorTest extends PHPUnit_Framework_TestCase {
$this->assertEquals('foobarbaz', $m->render('{{%IMPLICIT-ITERATOR iterator=i}}{{%DOT-NOTATION}}{{#items}}{{i.name}}{{/items}}')); $this->assertEquals('foobarbaz', $m->render('{{%IMPLICIT-ITERATOR iterator=i}}{{%DOT-NOTATION}}{{#items}}{{i.name}}{{/items}}'));
} }
public function testRecursiveSections() { /**
$m = new Mustache( * @dataProvider recursiveSectionData
'{{%IMPLICIT-ITERATOR}}{{#items}}{{#.}}{{.}}{{/.}}{{/items}}', */
array('items' => array(array('a', 'b', 'c'), array('d', 'e', 'f'))) public function testRecursiveSections($template, $view, $result) {
$m = new Mustache();
$this->assertEquals($result, $m->render($template, $view));
}
public function recursiveSectionData() {
return array(
array(
'{{%IMPLICIT-ITERATOR}}{{#items}}{{#.}}{{.}}{{/.}}{{/items}}',
array('items' => array(array('a', 'b', 'c'), array('d', 'e', 'f'))),
'abcdef'
),
array(
'{{%IMPLICIT-ITERATOR}}{{#items}}{{#.}}{{#.}}{{.}}{{/.}}{{/.}}{{/items}}',
array('items' => array(array(array('a', 'b'), array('c')), array(array('d'), array('e', 'f')))),
'abcdef'
),
array(
'{{%IMPLICIT-ITERATOR}}{{#items}}{{#.}}{{#items}}{{.}}{{/items}}{{/.}}{{/items}}',
array('items' => array(
array('items' => array('a', 'b', 'c')),
array('items' => array('d', 'e', 'f')),
)),
'abcdef'
),
); );
$this->assertEquals('abcdef', $m->render());
} }
} }