Beispiel #1
0
 /**
  * Create a snippet function for the fragment selected from
  * the specified file.  The return value is then callable with some
  * data than the $handler expects.  The handler then needs to
  * return an array of selector/transformer key values pairs
  *
  * @param string $path
  * @param string $selector
  * @param Callable $handler Optional
  *
  * @return Callable
  */
 public static function snippet($path, $selector, $handler = null)
 {
     return function () use($path, $selector, $handler) {
         $args = func_get_args();
         return Template::fetch($path, $handler ? call_user_func_array($handler, $args) : array(), $selector);
     };
 }
Beispiel #2
0
 public function testElementsCanBeReplacedWithHtml()
 {
     $html = T::fetch($this->p, array('.things' => T::replaceWith('<b>Gone...</b>')));
     $this->assertNotContains('class="things"', $html);
     $this->assertContains('<b>Gone...</b>', $html);
 }