From 39b24c1933bde02b1535a5ba10b322bfb696a4aa Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Sun, 15 Aug 2010 06:53:12 -0400 Subject: [PATCH] Update mustache object section test to cover class method access for embedded objects. --- test/MustacheObjectSectionTest.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/MustacheObjectSectionTest.php b/test/MustacheObjectSectionTest.php index f9ae45b..17ad2e0 100644 --- a/test/MustacheObjectSectionTest.php +++ b/test/MustacheObjectSectionTest.php @@ -17,6 +17,12 @@ class MustacheObjectSectionTest extends PHPUnit_Framework_TestCase { $gamma = new Gamma(); $this->assertEquals('Foo', $gamma->render('{{#bar}}{{#foo}}{{name}}{{/foo}}{{/bar}}')); } + + public function testSectionObjectWithFunction() { + $alpha = new Alpha(); + $alpha->foo = new Delta(); + $this->assertEquals('Foo', $alpha->render('{{#foo}}{{name}}{{/foo}}')); + } } class Alpha extends Mustache { @@ -53,4 +59,12 @@ class Gamma extends Mustache { public function __construct() { $this->bar = new Beta(); } +} + +class Delta extends Mustache { + protected $_name = 'Foo'; + + public function name() { + return $this->_name; + } } \ No newline at end of file