diff options
Diffstat (limited to 'vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance')
18 files changed, 293 insertions, 0 deletions
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test new file mode 100644 index 00000000..0778a4b4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/basic.test | |||
@@ -0,0 +1,14 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "foo.twig" %} | ||
5 | |||
6 | {% block content %} | ||
7 | FOO | ||
8 | {% endblock %} | ||
9 | --TEMPLATE(foo.twig)-- | ||
10 | {% block content %}{% endblock %} | ||
11 | --DATA-- | ||
12 | return array() | ||
13 | --EXPECT-- | ||
14 | FOO | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test new file mode 100644 index 00000000..8576e773 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/conditional.test | |||
@@ -0,0 +1,14 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends standalone ? foo : 'bar.twig' %} | ||
5 | |||
6 | {% block content %}{{ parent() }}FOO{% endblock %} | ||
7 | --TEMPLATE(foo.twig)-- | ||
8 | {% block content %}FOO{% endblock %} | ||
9 | --TEMPLATE(bar.twig)-- | ||
10 | {% block content %}BAR{% endblock %} | ||
11 | --DATA-- | ||
12 | return array('foo' => 'foo.twig', 'standalone' => true) | ||
13 | --EXPECT-- | ||
14 | FOOFOO | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test new file mode 100644 index 00000000..ee06ddce --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/dynamic.test | |||
@@ -0,0 +1,14 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends foo %} | ||
5 | |||
6 | {% block content %} | ||
7 | FOO | ||
8 | {% endblock %} | ||
9 | --TEMPLATE(foo.twig)-- | ||
10 | {% block content %}{% endblock %} | ||
11 | --DATA-- | ||
12 | return array('foo' => 'foo.twig') | ||
13 | --EXPECT-- | ||
14 | FOO | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test new file mode 100644 index 00000000..784f3571 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/empty.test | |||
@@ -0,0 +1,10 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "foo.twig" %} | ||
5 | --TEMPLATE(foo.twig)-- | ||
6 | {% block content %}FOO{% endblock %} | ||
7 | --DATA-- | ||
8 | return array() | ||
9 | --EXPECT-- | ||
10 | FOO | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test new file mode 100644 index 00000000..a1cb1ce8 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/extends_as_array.test | |||
@@ -0,0 +1,12 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends ["foo.twig", "bar.twig"] %} | ||
5 | --TEMPLATE(bar.twig)-- | ||
6 | {% block content %} | ||
7 | foo | ||
8 | {% endblock %} | ||
9 | --DATA-- | ||
10 | return array() | ||
11 | --EXPECT-- | ||
12 | foo | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test new file mode 100644 index 00000000..dfc2b6c4 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/multiple.test | |||
@@ -0,0 +1,12 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "layout.twig" %}{% block content %}{{ parent() }}index {% endblock %} | ||
5 | --TEMPLATE(layout.twig)-- | ||
6 | {% extends "base.twig" %}{% block content %}{{ parent() }}layout {% endblock %} | ||
7 | --TEMPLATE(base.twig)-- | ||
8 | {% block content %}base {% endblock %} | ||
9 | --DATA-- | ||
10 | return array() | ||
11 | --EXPECT-- | ||
12 | base layout index | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test new file mode 100644 index 00000000..faca9259 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks.test | |||
@@ -0,0 +1,22 @@ | |||
1 | --TEST-- | ||
2 | "block" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "foo.twig" %} | ||
5 | |||
6 | {% block content %} | ||
7 | {% block subcontent %} | ||
8 | {% block subsubcontent %} | ||
9 | SUBSUBCONTENT | ||
10 | {% endblock %} | ||
11 | {% endblock %} | ||
12 | {% endblock %} | ||
13 | --TEMPLATE(foo.twig)-- | ||
14 | {% block content %} | ||
15 | {% block subcontent %} | ||
16 | SUBCONTENT | ||
17 | {% endblock %} | ||
18 | {% endblock %} | ||
19 | --DATA-- | ||
20 | return array() | ||
21 | --EXPECT-- | ||
22 | SUBSUBCONTENT | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test new file mode 100644 index 00000000..0ad11d0c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_blocks_parent_only.test | |||
@@ -0,0 +1,15 @@ | |||
1 | --TEST-- | ||
2 | "block" tag | ||
3 | --TEMPLATE-- | ||
4 | {% block content %} | ||
5 | CONTENT | ||
6 | {%- block subcontent -%} | ||
7 | SUBCONTENT | ||
8 | {%- endblock -%} | ||
9 | ENDCONTENT | ||
10 | {% endblock %} | ||
11 | --TEMPLATE(foo.twig)-- | ||
12 | --DATA-- | ||
13 | return array() | ||
14 | --EXPECT-- | ||
15 | CONTENTSUBCONTENTENDCONTENT | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test new file mode 100644 index 00000000..71e3cdfd --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/nested_inheritance.test | |||
@@ -0,0 +1,16 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "layout.twig" %} | ||
5 | {% block inside %}INSIDE{% endblock inside %} | ||
6 | --TEMPLATE(layout.twig)-- | ||
7 | {% extends "base.twig" %} | ||
8 | {% block body %} | ||
9 | {% block inside '' %} | ||
10 | {% endblock body %} | ||
11 | --TEMPLATE(base.twig)-- | ||
12 | {% block body '' %} | ||
13 | --DATA-- | ||
14 | return array() | ||
15 | --EXPECT-- | ||
16 | INSIDE | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test new file mode 100644 index 00000000..4f975db8 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent.test | |||
@@ -0,0 +1,12 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "foo.twig" %} | ||
5 | |||
6 | {% block content %}{{ parent() }}FOO{{ parent() }}{% endblock %} | ||
7 | --TEMPLATE(foo.twig)-- | ||
8 | {% block content %}BAR{% endblock %} | ||
9 | --DATA-- | ||
10 | return array() | ||
11 | --EXPECT-- | ||
12 | BARFOOBAR | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test new file mode 100644 index 00000000..a8bc90ce --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_change.test | |||
@@ -0,0 +1,16 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends foo ? 'foo.twig' : 'bar.twig' %} | ||
5 | --TEMPLATE(foo.twig)-- | ||
6 | FOO | ||
7 | --TEMPLATE(bar.twig)-- | ||
8 | BAR | ||
9 | --DATA-- | ||
10 | return array('foo' => true) | ||
11 | --EXPECT-- | ||
12 | FOO | ||
13 | --DATA-- | ||
14 | return array('foo' => false) | ||
15 | --EXPECT-- | ||
16 | BAR | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test new file mode 100644 index 00000000..c9e86b1a --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_in_a_block.test | |||
@@ -0,0 +1,8 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% block content %} | ||
5 | {% extends "foo.twig" %} | ||
6 | {% endblock %} | ||
7 | --EXCEPTION-- | ||
8 | Twig_Error_Syntax: Cannot extend from a block in "index.twig" at line 3 | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test new file mode 100644 index 00000000..62816713 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_isolation.test | |||
@@ -0,0 +1,20 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "base.twig" %} | ||
5 | {% block content %}{% include "included.twig" %}{% endblock %} | ||
6 | |||
7 | {% block footer %}Footer{% endblock %} | ||
8 | --TEMPLATE(included.twig)-- | ||
9 | {% extends "base.twig" %} | ||
10 | {% block content %}Included Content{% endblock %} | ||
11 | --TEMPLATE(base.twig)-- | ||
12 | {% block content %}Default Content{% endblock %} | ||
13 | |||
14 | {% block footer %}Default Footer{% endblock %} | ||
15 | --DATA-- | ||
16 | return array() | ||
17 | --EXPECT-- | ||
18 | Included Content | ||
19 | Default Footer | ||
20 | Footer | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test new file mode 100644 index 00000000..71e7c208 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_nested.test | |||
@@ -0,0 +1,28 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag | ||
3 | --TEMPLATE-- | ||
4 | {% extends "foo.twig" %} | ||
5 | |||
6 | {% block content %} | ||
7 | {% block inside %} | ||
8 | INSIDE OVERRIDDEN | ||
9 | {% endblock %} | ||
10 | |||
11 | BEFORE | ||
12 | {{ parent() }} | ||
13 | AFTER | ||
14 | {% endblock %} | ||
15 | --TEMPLATE(foo.twig)-- | ||
16 | {% block content %} | ||
17 | BAR | ||
18 | {% endblock %} | ||
19 | --DATA-- | ||
20 | return array() | ||
21 | --EXPECT-- | ||
22 | |||
23 | INSIDE OVERRIDDEN | ||
24 | |||
25 | BEFORE | ||
26 | BAR | ||
27 | |||
28 | AFTER | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test new file mode 100644 index 00000000..a9eaa4c1 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends.test | |||
@@ -0,0 +1,8 @@ | |||
1 | --TEST-- | ||
2 | "parent" tag | ||
3 | --TEMPLATE-- | ||
4 | {% block content %} | ||
5 | {{ parent() }} | ||
6 | {% endblock %} | ||
7 | --EXCEPTION-- | ||
8 | Twig_Error_Syntax: Calling "parent" on a template that does not extend nor "use" another template is forbidden in "index.twig" at line 3 | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test new file mode 100644 index 00000000..63c73055 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/parent_without_extends_but_traits.test | |||
@@ -0,0 +1,14 @@ | |||
1 | --TEST-- | ||
2 | "parent" tag | ||
3 | --TEMPLATE-- | ||
4 | {% use 'foo.twig' %} | ||
5 | |||
6 | {% block content %} | ||
7 | {{ parent() }} | ||
8 | {% endblock %} | ||
9 | --TEMPLATE(foo.twig)-- | ||
10 | {% block content %}BAR{% endblock %} | ||
11 | --DATA-- | ||
12 | return array() | ||
13 | --EXPECT-- | ||
14 | BAR | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test new file mode 100644 index 00000000..d1876a52 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/template_instance.test | |||
@@ -0,0 +1,14 @@ | |||
1 | --TEST-- | ||
2 | "extends" tag accepts Twig_Template instance | ||
3 | --TEMPLATE-- | ||
4 | {% extends foo %} | ||
5 | |||
6 | {% block content %} | ||
7 | {{ parent() }}FOO | ||
8 | {% endblock %} | ||
9 | --TEMPLATE(foo.twig)-- | ||
10 | {% block content %}BAR{% endblock %} | ||
11 | --DATA-- | ||
12 | return array('foo' => $twig->loadTemplate('foo.twig')) | ||
13 | --EXPECT-- | ||
14 | BARFOO | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test new file mode 100644 index 00000000..8f9ece7c --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/inheritance/use.test | |||
@@ -0,0 +1,44 @@ | |||
1 | --TEST-- | ||
2 | "parent" function | ||
3 | --TEMPLATE-- | ||
4 | {% extends "parent.twig" %} | ||
5 | |||
6 | {% use "use1.twig" %} | ||
7 | {% use "use2.twig" %} | ||
8 | |||
9 | {% block content_parent %} | ||
10 | {{ parent() }} | ||
11 | {% endblock %} | ||
12 | |||
13 | {% block content_use1 %} | ||
14 | {{ parent() }} | ||
15 | {% endblock %} | ||
16 | |||
17 | {% block content_use2 %} | ||
18 | {{ parent() }} | ||
19 | {% endblock %} | ||
20 | |||
21 | {% block content %} | ||
22 | {{ block('content_use1_only') }} | ||
23 | {{ block('content_use2_only') }} | ||
24 | {% endblock %} | ||
25 | --TEMPLATE(parent.twig)-- | ||
26 | {% block content_parent 'content_parent' %} | ||
27 | {% block content_use1 'content_parent' %} | ||
28 | {% block content_use2 'content_parent' %} | ||
29 | {% block content '' %} | ||
30 | --TEMPLATE(use1.twig)-- | ||
31 | {% block content_use1 'content_use1' %} | ||
32 | {% block content_use2 'content_use1' %} | ||
33 | {% block content_use1_only 'content_use1_only' %} | ||
34 | --TEMPLATE(use2.twig)-- | ||
35 | {% block content_use2 'content_use2' %} | ||
36 | {% block content_use2_only 'content_use2_only' %} | ||
37 | --DATA-- | ||
38 | return array() | ||
39 | --EXPECT-- | ||
40 | content_parent | ||
41 | content_use1 | ||
42 | content_use2 | ||
43 | content_use1_only | ||
44 | content_use2_only | ||