Yaffs site version 1.1
[yaffs-website] / vendor / twig / twig / test / Twig / Tests / Fixtures / tests / defined_for_blocks.test
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tests/defined_for_blocks.test
new file mode 100644 (file)
index 0000000..64d7d04
--- /dev/null
@@ -0,0 +1,38 @@
+--TEST--
+"defined" support for blocks
+--TEMPLATE--
+{% extends 'parent' %}
+{% block icon %}icon{% endblock %}
+{% block body %}
+    {{ parent() }}
+    {{ block('foo') is defined ? 'ok' : 'ko' }}
+    {{ block('footer') is defined ? 'ok' : 'ko' }}
+    {{ block('icon') is defined ? 'ok' : 'ko' }}
+    {{ block('block1') is defined ? 'ok' : 'ko' }}
+    {%- embed 'embed' %}
+        {% block content %}content{% endblock %}
+    {% endembed %}
+{% endblock %}
+{% use 'blocks' %}
+--TEMPLATE(parent)--
+{% block body %}
+  {{ block('icon') is defined ? 'ok' : 'ko' -}}
+{% endblock %}
+{% block footer %}{% endblock %}
+--TEMPLATE(embed)--
+{{ block('icon') is defined ? 'ok' : 'ko' }}
+{{ block('content') is defined ? 'ok' : 'ko' }}
+{{ block('block1') is defined ? 'ok' : 'ko' }}
+--TEMPLATE(blocks)--
+{% block block1 %}{%endblock %}
+--DATA--
+return array()
+--EXPECT--
+ok
+    ko
+    ok
+    ok
+    ok
+ko
+ok
+ko