Selaa lähdekoodia

Update mustache object section test to cover class method access for embedded objects.

Justin Hileman 15 vuotta sitten
vanhempi
sitoutus
39b24c1933
1 muutettua tiedostoa jossa 14 lisäystä ja 0 poistoa
  1. 14 0
      test/MustacheObjectSectionTest.php

+ 14 - 0
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;
+	}
 }