Skip to content

Commit

Permalink
nested repeaters tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hokoo committed Aug 26, 2024
1 parent e820a90 commit aed0969
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/TemplaterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,41 @@ public function testRender() {
</div>
EXPECTED;

$this->assertEquals( $expected, $result );

/**
* Template with nested repeaters.
*/
$tpl = <<<TEMPLATE
<div class="classname">
%s[[tag1]]<div class="tag1">
%s[[tag2]]<div class="tag2">%s</div>[[/tag2]]
</div>[[/tag1]]
</div>
TEMPLATE;

$result = $templater->render( $tpl, [
[
[
'tag' => 'tag1',
'content' => [
[
[ 'tag' => 'tag2', 'content' => 'CONTENT2' ],
],
]
],
],
] );

$expected = <<<EXPECTED
<div class="classname">
<div class="tag1">
<div class="tag2">CONTENT2</div>
</div>
</div>
EXPECTED;


$this->assertEquals( $expected, $result );
}
}

0 comments on commit aed0969

Please sign in to comment.