protected function setUp() { $this->runtime = new Handlebars\Runtime(); $this->runtime->addHelper("testinglink", function ($url, $text) { $string = sprintf('<a href="%1$s">%2$s</a>', $url, $text); return new Handlebars\SafeString($string); }); }
protected function setUp() { $runtime = new Handlebars\Runtime(); $runtime->addHelper("startswithfoo", function ($value) { return "foo{$value}"; }); $runtime->addHelper("testinglink", function ($url, $text) { $string = sprintf('<a href="%1$s">%2$s</a>', $url, $text); return new Handlebars\SafeString($string); }); $argumentParserFactory = new Handlebars\Argument\ArgumentParserFactory(new Handlebars\Argument\ArgumentListFactory()); $this->compiler = new Handlebars\Compiler($runtime, new Handlebars\TokenizerFactory(), $argumentParserFactory); }
/** * @expectedException MattyG\Handlebars\Exception * @expectedExceptionMessage All Handlebars helpers must be callable */ public function testAddNonCallableHelper() { $runtime = new Handlebars\Runtime(false); $runtime->addHelper("foo", 1); }