فهرست منبع

Merge remote-tracking branch 'conormcd/test-gist-655784' into dev

Justin Hileman 13 سال پیش
والد
کامیت
136fdf32c0
1فایلهای تغییر یافته به همراه24 افزوده شده و 0 حذف شده
  1. 24 0
      test/MustacheCallTest.php

+ 24 - 0
test/MustacheCallTest.php

@@ -0,0 +1,24 @@
+<?php
+
+require_once '../Mustache.php';
+
+class MustacheCallTest extends PHPUnit_Framework_TestCase {
+
+	public function testCallEatsContext() {
+		$foo = new Foo();
+		$foo->name = 'Bob';
+
+		$template = '{{# foo }}{{ label }}: {{ name }}{{/ foo }}';
+		$data = array('label' => 'name', 'foo' => $foo);
+		$m = new Mustache($template, $data);
+
+		$this->assertEquals('name: Bob', $m->render());
+	}
+}
+
+class Foo {
+	public $name;
+	public function __call($method, $args) {
+		return 'unknown value';
+	}
+}