From efb7b479d3ad262e1295b67ab3677c05d689eb37 Mon Sep 17 00:00:00 2001 From: Adrien Brault Date: Thu, 23 Jan 2014 15:18:05 -0800 Subject: [PATCH] Add "broken" block inheritance test case --- .../Fixtures/tags/inheritance/block_expr.test | 32 ++++++++++++++++++ .../Fixtures/tags/inheritance/block_expr2.test | 34 ++++++++++++++++++++ 2 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test create mode 100644 test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test diff --git a/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test b/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test new file mode 100644 index 0000000..9a81499 --- /dev/null +++ b/test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test @@ -0,0 +1,32 @@ +--TEST-- +block_expr +--TEMPLATE-- +{% extends "base.twig" %} + +{% block element -%} + Element: + {{- parent() -}} +{% endblock %} +--TEMPLATE(base.twig)-- +{% spaceless %} +{% block element -%} +
+ {%- if item.children is defined %} + {%- for item in item.children %} + {{- block('element') -}} + {% endfor %} + {%- endif -%} +
+{%- endblock %} +{% endspaceless %} +--DATA-- +return array( + 'item' => array( + 'children' => array( + null, + null, + ) + ) +) +--EXPECT-- +Element:
Element:
Element:
diff --git a/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test b/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test new file mode 100644 index 0000000..3e868c0 --- /dev/null +++ b/test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test @@ -0,0 +1,34 @@ +--TEST-- +block_expr2 +--TEMPLATE-- +{% extends "base2.twig" %} + +{% block element -%} + Element: + {{- parent() -}} +{% endblock %} +--TEMPLATE(base2.twig)-- +{% extends "base.twig" %} +--TEMPLATE(base.twig)-- +{% spaceless %} +{% block element -%} +
+ {%- if item.children is defined %} + {%- for item in item.children %} + {{- block('element') -}} + {% endfor %} + {%- endif -%} +
+{%- endblock %} +{% endspaceless %} +--DATA-- +return array( + 'item' => array( + 'children' => array( + null, + null, + ) + ) +) +--EXPECT-- +Element:
Element:
Element:
-- 1.7.2.5