Update mustache object section test to cover class method access for embedded objects.
This commit is contained in:
@@ -17,6 +17,12 @@ class MustacheObjectSectionTest extends PHPUnit_Framework_TestCase {
|
|||||||
$gamma = new Gamma();
|
$gamma = new Gamma();
|
||||||
$this->assertEquals('Foo', $gamma->render('{{#bar}}{{#foo}}{{name}}{{/foo}}{{/bar}}'));
|
$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 {
|
class Alpha extends Mustache {
|
||||||
@@ -54,3 +60,11 @@ class Gamma extends Mustache {
|
|||||||
$this->bar = new Beta();
|
$this->bar = new Beta();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Delta extends Mustache {
|
||||||
|
protected $_name = 'Foo';
|
||||||
|
|
||||||
|
public function name() {
|
||||||
|
return $this->_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user