diff options
Diffstat (limited to 'vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter')
6 files changed, 86 insertions, 0 deletions
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test new file mode 100644 index 00000000..82094f2f --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/basic.test | |||
@@ -0,0 +1,10 @@ | |||
1 | --TEST-- | ||
2 | "filter" tag applies a filter on its children | ||
3 | --TEMPLATE-- | ||
4 | {% filter upper %} | ||
5 | Some text with a {{ var }} | ||
6 | {% endfilter %} | ||
7 | --DATA-- | ||
8 | return array('var' => 'var') | ||
9 | --EXPECT-- | ||
10 | SOME TEXT WITH A VAR | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test new file mode 100644 index 00000000..3e7148bf --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/json_encode.test | |||
@@ -0,0 +1,8 @@ | |||
1 | --TEST-- | ||
2 | "filter" tag applies a filter on its children | ||
3 | --TEMPLATE-- | ||
4 | {% filter json_encode|raw %}test{% endfilter %} | ||
5 | --DATA-- | ||
6 | return array() | ||
7 | --EXPECT-- | ||
8 | "test" | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test new file mode 100644 index 00000000..75512ef9 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/multiple.test | |||
@@ -0,0 +1,10 @@ | |||
1 | --TEST-- | ||
2 | "filter" tags accept multiple chained filters | ||
3 | --TEMPLATE-- | ||
4 | {% filter lower|title %} | ||
5 | {{ var }} | ||
6 | {% endfilter %} | ||
7 | --DATA-- | ||
8 | return array('var' => 'VAR') | ||
9 | --EXPECT-- | ||
10 | Var | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test new file mode 100644 index 00000000..7e4e4eb3 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/nested.test | |||
@@ -0,0 +1,16 @@ | |||
1 | --TEST-- | ||
2 | "filter" tags can be nested at will | ||
3 | --TEMPLATE-- | ||
4 | {% filter lower|title %} | ||
5 | {{ var }} | ||
6 | {% filter upper %} | ||
7 | {{ var }} | ||
8 | {% endfilter %} | ||
9 | {{ var }} | ||
10 | {% endfilter %} | ||
11 | --DATA-- | ||
12 | return array('var' => 'var') | ||
13 | --EXPECT-- | ||
14 | Var | ||
15 | Var | ||
16 | Var | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test new file mode 100644 index 00000000..22745ead --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_for_tag.test | |||
@@ -0,0 +1,13 @@ | |||
1 | --TEST-- | ||
2 | "filter" tag applies the filter on "for" tags | ||
3 | --TEMPLATE-- | ||
4 | {% filter upper %} | ||
5 | {% for item in items %} | ||
6 | {{ item }} | ||
7 | {% endfor %} | ||
8 | {% endfilter %} | ||
9 | --DATA-- | ||
10 | return array('items' => array('a', 'b')) | ||
11 | --EXPECT-- | ||
12 | A | ||
13 | B | ||
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test new file mode 100644 index 00000000..afd95b29 --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/filter/with_if_tag.test | |||
@@ -0,0 +1,29 @@ | |||
1 | --TEST-- | ||
2 | "filter" tag applies the filter on "if" tags | ||
3 | --TEMPLATE-- | ||
4 | {% filter upper %} | ||
5 | {% if items %} | ||
6 | {{ items|join(', ') }} | ||
7 | {% endif %} | ||
8 | |||
9 | {% if items.3 is defined %} | ||
10 | FOO | ||
11 | {% else %} | ||
12 | {{ items.1 }} | ||
13 | {% endif %} | ||
14 | |||
15 | {% if items.3 is defined %} | ||
16 | FOO | ||
17 | {% elseif items.1 %} | ||
18 | {{ items.0 }} | ||
19 | {% endif %} | ||
20 | |||
21 | {% endfilter %} | ||
22 | --DATA-- | ||
23 | return array('items' => array('a', 'b')) | ||
24 | --EXPECT-- | ||
25 | A, B | ||
26 | |||
27 | B | ||
28 | |||
29 | A | ||