Ejemplo n.º 1
0
 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);
     });
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
 /**
  * @expectedException MattyG\Handlebars\Exception
  * @expectedExceptionMessage All Handlebars helpers must be callable
  */
 public function testAddNonCallableHelper()
 {
     $runtime = new Handlebars\Runtime(false);
     $runtime->addHelper("foo", 1);
 }