Add "broken" block inheritance test case
authorAdrien Brault <adrien.brault@gmail.com>
Thu, 23 Jan 2014 23:18:05 +0000 (15:18 -0800)
committerMartin Hasoň <martin.hason@gmail.com>
Thu, 13 Mar 2014 11:40:24 +0000 (12:40 +0100)
test/Twig/Tests/Fixtures/tags/inheritance/block_expr.test [new file with mode: 0644]
test/Twig/Tests/Fixtures/tags/inheritance/block_expr2.test [new file with mode: 0644]

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 (file)
index 0000000..9a81499
--- /dev/null
@@ -0,0 +1,32 @@
+--TEST--
+block_expr
+--TEMPLATE--
+{% extends "base.twig" %}
+
+{% block element -%}
+    Element:
+    {{- parent() -}}
+{% endblock %}
+--TEMPLATE(base.twig)--
+{% spaceless %}
+{% block element -%}
+    <div>
+        {%- if item.children is defined %}
+            {%- for item in item.children %}
+                {{- block('element') -}}
+            {% endfor %}
+        {%- endif -%}
+    </div>
+{%- endblock %}
+{% endspaceless %}
+--DATA--
+return array(
+    'item' => array(
+        'children' => array(
+            null,
+            null,
+        )
+    )
+)
+--EXPECT--
+Element:<div>Element:<div></div>Element:<div></div></div>
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 (file)
index 0000000..3e868c0
--- /dev/null
@@ -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 -%}
+    <div>
+        {%- if item.children is defined %}
+            {%- for item in item.children %}
+                {{- block('element') -}}
+            {% endfor %}
+        {%- endif -%}
+    </div>
+{%- endblock %}
+{% endspaceless %}
+--DATA--
+return array(
+    'item' => array(
+        'children' => array(
+            null,
+            null,
+        )
+    )
+)
+--EXPECT--
+Element:<div>Element:<div></div>Element:<div></div></div>