Exemplo n.º 1
0
 /**
  * @expectedException EmulateBugException
  */
 public function testExtendsWithFilterException()
 {
     $jade = new Jade();
     $jade->filter('throw-exception', function () {
         throw new EmulateBugException("Bad filter", 1);
     });
     $jade->render(__DIR__ . '/../templates/auxiliary/extends-exception-filter.jade');
 }
Exemplo n.º 2
0
    public function testInlineFilter()
    {
        $jade = new Jade();
        $jade->filter('lower', function ($node, $compiler) {
            foreach ($node->block->nodes as $line) {
                $output[] = $line->value;
            }
            return strtolower(implode(' ', $output));
        });
        $actual = $jade->render('
h1
    | BAR-
    :lower FOO
    | -BAR
');
        $expected = '<h1>BAR-foo-BAR</h1>';
        $this->assertSame($expected, $actual, 'One-line filter');
        $actual = $jade->render('h1 BAR-#[:lower FOO]-BAR');
        $expected = '<h1>BAR-foo-BAR</h1>';
        $this->assertSame($expected, $actual, 'In-line filter');
    }