diff --git a/test/MustacheHigherOrderSectionsTest.php b/test/MustacheHigherOrderSectionsTest.php index 63b8d3b..1d3ac35 100644 --- a/test/MustacheHigherOrderSectionsTest.php +++ b/test/MustacheHigherOrderSectionsTest.php @@ -83,6 +83,18 @@ class MustacheHigherOrderSectionsTest extends PHPUnit_Framework_TestCase { $this->foo->render('{{#wrap}}{{name}}{{/wrap}}', $data) ); } + + public function testMonsters() { + $frank = new Monster(); + $frank->title = 'Dr.'; + $frank->name = 'Frankenstein'; + $this->assertEquals('Dr. Frankenstein', $frank->render()); + + $dracula = new Monster(); + $dracula->title = 'Count'; + $dracula->name = 'Dracula'; + $this->assertEquals('Count Dracula', $dracula->render()); + } } class Foo extends Mustache { @@ -106,7 +118,7 @@ class Foo extends Mustache { public function wrapWithBoth($text) { return self::wrapWithStrong(self::wrapWithEm($text)); } - + public static function staticTrim($text) { return trim($text); } @@ -114,4 +126,10 @@ class Foo extends Mustache { function make_my_logo_bigger($text) { return sprintf('

%s

', $text); +} + +class Monster extends Mustache { + public $_template = '{{#title}}{{title}} {{/title}}{{name}}'; + public $title; + public $name; } \ No newline at end of file