16 'index' =>
'{% block foo %}{% endblock %}',
17 'index_with_use' =>
'{% use "imported" %}{% block foo %}{% endblock %}',
18 'index_with_extends' =>
'{% extends "extended" %}{% block foo %}{% endblock %}',
19 'imported' =>
'{% block imported %}{% endblock %}',
20 'extended' =>
'{% block extended %}{% endblock %}',
24 $this->assertTrue($wrapper->hasBlock(
'foo'));
25 $this->assertFalse($wrapper->hasBlock(
'bar'));
26 $this->assertEquals(array(
'foo'), $wrapper->getBlockNames());
29 $this->assertTrue($wrapper->hasBlock(
'foo'));
30 $this->assertTrue($wrapper->hasBlock(
'imported'));
31 $this->assertEquals(array(
'imported',
'foo'), $wrapper->getBlockNames());
34 $this->assertTrue($wrapper->hasBlock(
'foo'));
35 $this->assertTrue($wrapper->hasBlock(
'extended'));
36 $this->assertEquals(array(
'foo',
'extended'), $wrapper->getBlockNames());
42 'index' =>
'{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
44 $twig->addGlobal(
'bar',
'BAR');
47 $this->assertEquals(
'FOOBAR', $wrapper->renderBlock(
'foo', array(
'foo' =>
'FOO')));
53 'index' =>
'{% block foo %}{{ foo }}{{ bar }}{% endblock %}',
55 $twig->addGlobal(
'bar',
'BAR');
60 $wrapper->displayBlock(
'foo', array(
'foo' =>
'FOO'));
62 $this->assertEquals(
'FOOBAR', ob_get_clean());
Exposes a template to userland.
Stores the Twig configuration.
Loads a template from an array.