diff options
Diffstat (limited to 'vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test')
-rw-r--r-- | vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test new file mode 100644 index 00000000..134c77ea --- /dev/null +++ b/vendor/twig/twig/test/Twig/Tests/Fixtures/tags/autoescape/with_pre_escape_filters.test | |||
@@ -0,0 +1,68 @@ | |||
1 | --TEST-- | ||
2 | "autoescape" tag applies escaping after calling filters, and before calling pre_escape filters | ||
3 | --TEMPLATE-- | ||
4 | {% autoescape 'html' %} | ||
5 | |||
6 | (nl2br is pre_escaped for "html" and declared safe for "html") | ||
7 | |||
8 | 1. Pre-escape and don't post-escape | ||
9 | ( var|escape|nl2br ) | ||
10 | {{ var|nl2br }} | ||
11 | |||
12 | 2. Don't double-pre-escape | ||
13 | ( var|escape|nl2br ) | ||
14 | {{ var|escape|nl2br }} | ||
15 | |||
16 | 3. Don't escape safe values | ||
17 | ( var|raw|nl2br ) | ||
18 | {{ var|raw|nl2br }} | ||
19 | |||
20 | 4. Don't escape safe values | ||
21 | ( var|escape|nl2br|nl2br ) | ||
22 | {{ var|nl2br|nl2br }} | ||
23 | |||
24 | 5. Re-escape values that are escaped for an other contexts | ||
25 | ( var|escape_something|escape|nl2br ) | ||
26 | {{ var|escape_something|nl2br }} | ||
27 | |||
28 | 6. Still escape when using filters not declared safe | ||
29 | ( var|escape|nl2br|upper|escape ) | ||
30 | {{ var|nl2br|upper }} | ||
31 | |||
32 | {% endautoescape %} | ||
33 | --DATA-- | ||
34 | return array('var' => "<Fabien>\nTwig") | ||
35 | --EXPECT-- | ||
36 | |||
37 | (nl2br is pre_escaped for "html" and declared safe for "html") | ||
38 | |||
39 | 1. Pre-escape and don't post-escape | ||
40 | ( var|escape|nl2br ) | ||
41 | <Fabien><br /> | ||
42 | Twig | ||
43 | |||
44 | 2. Don't double-pre-escape | ||
45 | ( var|escape|nl2br ) | ||
46 | <Fabien><br /> | ||
47 | Twig | ||
48 | |||
49 | 3. Don't escape safe values | ||
50 | ( var|raw|nl2br ) | ||
51 | <Fabien><br /> | ||
52 | Twig | ||
53 | |||
54 | 4. Don't escape safe values | ||
55 | ( var|escape|nl2br|nl2br ) | ||
56 | <Fabien><br /><br /> | ||
57 | Twig | ||
58 | |||
59 | 5. Re-escape values that are escaped for an other contexts | ||
60 | ( var|escape_something|escape|nl2br ) | ||
61 | <FABIEN><br /> | ||
62 | TWIG | ||
63 | |||
64 | 6. Still escape when using filters not declared safe | ||
65 | ( var|escape|nl2br|upper|escape ) | ||
66 | &LT;FABIEN&GT;<BR /> | ||
67 | TWIG | ||
68 | |||