From 1ab066c718f8bc2386a6bed255a7377fcf29a339 Mon Sep 17 00:00:00 2001 From: Conor McDermottroe Date: Fri, 17 Feb 2012 18:26:58 +0000 Subject: [PATCH] Add a test to discourage people from implementing support for __call. Pull in the test from https://gist.github.com/655784 This should discourage reports like #16, #19 and #55, and #76. --- test/MustacheCallTest.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 test/MustacheCallTest.php diff --git a/test/MustacheCallTest.php b/test/MustacheCallTest.php new file mode 100644 index 0000000..48cd079 --- /dev/null +++ b/test/MustacheCallTest.php @@ -0,0 +1,24 @@ +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'; + } +}