Failing test for higher-order section side effects--issue #4
This commit is contained in:
@@ -83,6 +83,18 @@ class MustacheHigherOrderSectionsTest extends PHPUnit_Framework_TestCase {
|
|||||||
$this->foo->render('{{#wrap}}{{name}}{{/wrap}}', $data)
|
$this->foo->render('{{#wrap}}{{name}}{{/wrap}}', $data)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testMonsters() {
|
||||||
|
$frank = new Monster();
|
||||||
|
$frank->title = 'Dr.';
|
||||||
|
$frank->name = 'Frankenstein';
|
||||||
|
$this->assertEquals('Dr. Frankenstein', $frank->render());
|
||||||
|
|
||||||
|
$dracula = new Monster();
|
||||||
|
$dracula->title = 'Count';
|
||||||
|
$dracula->name = 'Dracula';
|
||||||
|
$this->assertEquals('Count Dracula', $dracula->render());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Foo extends Mustache {
|
class Foo extends Mustache {
|
||||||
@@ -106,7 +118,7 @@ class Foo extends Mustache {
|
|||||||
public function wrapWithBoth($text) {
|
public function wrapWithBoth($text) {
|
||||||
return self::wrapWithStrong(self::wrapWithEm($text));
|
return self::wrapWithStrong(self::wrapWithEm($text));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function staticTrim($text) {
|
public static function staticTrim($text) {
|
||||||
return trim($text);
|
return trim($text);
|
||||||
}
|
}
|
||||||
@@ -114,4 +126,10 @@ class Foo extends Mustache {
|
|||||||
|
|
||||||
function make_my_logo_bigger($text) {
|
function make_my_logo_bigger($text) {
|
||||||
return sprintf('<h1>%s</h1>', $text);
|
return sprintf('<h1>%s</h1>', $text);
|
||||||
|
}
|
||||||
|
|
||||||
|
class Monster extends Mustache {
|
||||||
|
public $_template = '{{#title}}{{title}} {{/title}}{{name}}';
|
||||||
|
public $title;
|
||||||
|
public $name;
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user