Exemple #1
0
 public function testDisplay()
 {
     $this->expectOutputString("data");
     $callback = $this->getMock('stdClass', array('__invoke'));
     $callback->expects($this->once())->method("__invoke")->with($this->equalTo("a string"), $this->equalTo(NULL), $this->equalTo(3.1415))->will($this->returnValue("data"));
     $tpl = new \r8\Template\Callback(array('one', 'two', 'three'), $callback);
     $tpl->set("one", "a string");
     $tpl->set("three", 3.1415);
     $this->assertSame($tpl, $tpl->display());
 }
Exemple #2
0
 /**
  * Builds a new callback template
  *
  * @param Array $arg The arguments to pass into the callback
  * @param Callable $callback The callback to invoke
  * @return \r8\Template\Callback
  */
 public function callback(array $args, $callback)
 {
     $tpl = new \r8\Template\Callback($args, $callback);
     $tpl->import($this->getValues());
     return $tpl;
 }