fixed usage of short array notation in tests

This commit is contained in:
Fabien Potencier
2019-01-08 10:28:35 +01:00
parent 0446296d5f
commit a0399fe6da
256 changed files with 272 additions and 272 deletions
@@ -14,8 +14,8 @@ blocks and autoescape
{% set _content = block('content')|raw %}
{{ _content|raw }}
--DATA--
return array('br' => '<br />')
return ['br' => '<br />']
--CONFIG--
return array('autoescape' => 'name')
return ['autoescape' => 'name']
--EXPECT--
&lt;br /&gt;
@@ -12,9 +12,9 @@
--TEMPLATE(index.txt.twig)--
{{ br -}}
--DATA--
return array('br' => '<br />')
return ['br' => '<br />']
--CONFIG--
return array('autoescape' => 'name')
return ['autoescape' => 'name']
--EXPECT--
&lt;br /&gt;
\u003Cbr\u0020\/\u003E
@@ -13,6 +13,6 @@ Exception for multiline array with undefined variable
foo2: foo2,
} %}
--DATA--
return array('foobar' => 'foobar')
return ['foobar' => 'foobar']
--EXCEPTION--
Twig_Error_Runtime: Variable "foo2" does not exist in "index.twig" at line 11.
@@ -13,6 +13,6 @@ Exception for multiline array with undefined variable
foo2: foo2,
} %}
--DATA--
return array()
return []
--EXCEPTION--
Twig_Error_Runtime: Variable "foobar" does not exist in "index.twig" at line 7.
@@ -7,6 +7,6 @@ Exception for multile function with undefined variable
--TEMPLATE(foo)--
Foo
--DATA--
return array()
return []
--EXCEPTION--
Twig_Error_Runtime: Variable "with_context" does not exist in "index.twig" at line 3.
@@ -7,6 +7,6 @@ Exception for multiline tag with undefined variable
--TEMPLATE(foo)--
Foo
--DATA--
return array()
return []
--EXCEPTION--
Twig_Error_Runtime: Variable "vars" does not exist in "index.twig" at line 3.
@@ -10,6 +10,6 @@ Exception for an undefined template in a child template
{% block sidebar %}
{% endblock %}
--DATA--
return array()
return []
--EXCEPTION--
Twig_Error_Loader: Template "include.twig" is not defined in "index.twig" at line 5.
@@ -3,6 +3,6 @@ _self returns the template name
--TEMPLATE--
{{ _self }}
--DATA--
return array()
return []
--EXPECT--
index.twig
@@ -38,7 +38,7 @@ Twig supports array notation
{{ ary|keys|join(',') }}
{{ ary|join(',') }}
--DATA--
return array('bar' => 'bar', 'foo' => array('bar' => 'bar'))
return ['bar' => 'bar', 'foo' => array('bar' => 'bar')]
--EXPECT--
1,2
foo,bar
@@ -6,7 +6,7 @@ Twig supports method calls
{{ items[foo] }}
{{ items[items[foo]] }}
--DATA--
return array('foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo'))
return ['foo' => 'bar', 'items' => array('foo' => 'bar', 'bar' => 'foo')]
--EXPECT--
bar
bar
@@ -22,7 +22,7 @@ Twig supports binary operations (+, -, *, /, ~, %, and, or)
{{ foo ~ bar }}
{{ 20 // 7 }}
--DATA--
return array('foo' => 'bar', 'bar' => 'foo')
return ['foo' => 'bar', 'bar' => 'foo']
--EXPECT--
2
1
@@ -6,7 +6,7 @@ Twig supports bitwise operations
{{ 1 b-xor 5 }}
{{ (1 and 0 b-or 0) is same as(1 and (0 b-or 0)) ? 'ok' : 'ko' }}
--DATA--
return array()
return []
--EXPECT--
1
5
@@ -6,7 +6,7 @@ Twig supports comparison operators (==, !=, <, >, >=, <=)
{{ 1 == 1 }}/{{ 1 == 2 }}
{{ 1 != 1 }}/{{ 1 != 2 }}
--DATA--
return array()
return []
--EXPECT--
///1
1//1/1
@@ -9,7 +9,7 @@ Twig supports the "divisible by" operator
by
(3) ? 'OK' }}
--DATA--
return array()
return []
--EXPECT--
OK
OK
@@ -11,7 +11,7 @@ Twig supports the .. operator
{% for i in 0 + 1 .. 10 - 1 %}{{ i }} {% endfor %}
--DATA--
return array('foo' => array(1, 10))
return ['foo' => array(1, 10)]
--EXPECT--
0 1 2 3 4 5 6 7 8 9 10
a b c d e f g h i j k l m n o p q r s t u v w x y z
@@ -12,7 +12,7 @@ Twig supports the "ends with" operator
{{ false ends with false ? 'OK' : 'KO' }}
{{ false ends with '' ? 'OK' : 'KO' }}
--DATA--
return array()
return []
--EXPECT--
OK
OK
@@ -3,6 +3,6 @@ Twig supports grouping of expressions
--TEMPLATE--
{{ (2 + 2) / 2 }}
--DATA--
return array()
return []
--EXPECT--
2
@@ -10,7 +10,7 @@ Twig supports literals
7 {{ null }}
8 {{ NULL }}
--DATA--
return array()
return []
--EXPECT--
1 1
2 1
@@ -21,7 +21,7 @@ class TestClassForMagicCallAttributes
}
}
return array('foo' => new TestClassForMagicCallAttributes())
return ['foo' => new TestClassForMagicCallAttributes()]
--EXPECT--
foo_from_call
bar_from_getbar
@@ -5,7 +5,7 @@ Twig supports the "matches" operator
{{ 'foo' matches '/^fo/' ? 'OK' : 'KO' }}
{{ 'foo' matches '/O/i' ? 'OK' : 'KO' }}
--DATA--
return array()
return []
--EXPECT--
OK
OK
@@ -12,9 +12,9 @@ Twig supports method calls
{{ items.foo.in }}
{{ items.foo.not }}
--DATA--
return array('foo' => 'bar', 'items' => array('foo' => new TwigTestFoo(), 'bar' => 'foo'))
return ['foo' => 'bar', 'items' => array('foo' => new TwigTestFoo(), 'bar' => 'foo')]
--CONFIG--
return array('strict_variables' => false)
return ['strict_variables' => false]
--EXPECT--
foo
foo
@@ -8,7 +8,7 @@ Twig manages negative numbers correctly
{{ 5 + -1 }}
{{ 5 + - 1 }}
--DATA--
return array()
return []
--EXPECT--
-1
-1
@@ -7,7 +7,7 @@ Twig allows to use named operators as variable names
{{ in }}
{{ is }}
--DATA--
return array('matches' => array(1, 2, 3), 'in' => 'in', 'is' => 'is')
return ['matches' => array(1, 2, 3), 'in' => 'in', 'is' => 'is']
--EXPECT--
1
2
@@ -12,7 +12,7 @@ Twig parses postfix expressions
{{ macros.foo() }}
{{ (macros).foo() }}
--DATA--
return array();
return []
--EXPECT--
a
A
@@ -9,7 +9,7 @@ Twig parses power expressions
{{ b ** a }}
{{ b ** b }}
--DATA--
return array('a' => 4, 'b' => -2);
return ['a' => 4, 'b' => -2]
--EXPECT--
8
-8
@@ -11,7 +11,7 @@ Twig supports the "same as" operator
as
(true) ? 'OK' }}
--DATA--
return array()
return []
--EXPECT--
OK
OK
@@ -13,7 +13,7 @@ with 'f' ? 'OK' : 'KO' }}
{{ 'a' starts with false ? 'OK' : 'KO' }}
{{ false starts with '' ? 'OK' : 'KO' }}
--DATA--
return array()
return []
--EXPECT--
OK
OK
@@ -4,7 +4,7 @@ Twig supports string interpolation
{{ "foo #{"foo #{bar} baz"} baz" }}
{{ "foo #{bar}#{bar} baz" }}
--DATA--
return array('bar' => 'BAR');
return ['bar' => 'BAR']
--EXPECT--
foo foo BAR baz baz
foo BARBAR baz
@@ -8,7 +8,7 @@ Twig supports the ternary operator
{{ 1 == 1 ? 'foo<br />':'' }}
{{ foo ~ (bar ? ('-' ~ bar) : '') }}
--DATA--
return array('foo' => 'foo', 'bar' => 'bar')
return ['foo' => 'foo', 'bar' => 'bar']
--EXPECT--
YES
NO
@@ -4,7 +4,7 @@ Twig supports the ternary operator
{{ 1 ? 'YES' }}
{{ 0 ? 'YES' }}
--DATA--
return array()
return []
--EXPECT--
YES
@@ -4,7 +4,7 @@ Twig supports the ternary operator
{{ 'YES' ?: 'NO' }}
{{ 0 ?: 'NO' }}
--DATA--
return array()
return []
--EXPECT--
YES
NO
@@ -3,6 +3,6 @@ Twig does not allow to use two-word named operators as variable names
--TEMPLATE--
{{ starts with }}
--DATA--
return array()
return []
--EXCEPTION--
Twig_Error_Syntax: Unexpected token "operator" of value "starts with" in "index.twig" at line 2.
@@ -5,7 +5,7 @@ Twig supports unary operators (not, -, +)
{{ +1 + 1 }}/{{ -1 - 1 }}
{{ not (false or true) }}
--DATA--
return array()
return []
--EXPECT--
/1
2/-2
@@ -13,7 +13,7 @@ Twig manages negative numbers as default parameters
{% macro positive_number1(nb = +1) %}{{ nb }}{% endmacro %}
{% macro positive_number2(nb = ++1) %}{{ nb }}{% endmacro %}
--DATA--
return array()
return []
--EXPECT--
-1
1
@@ -6,7 +6,7 @@ Twig unary operators precedence
{{ -1 * -1 }}
{{ 4 / -1 * 5 }}
--DATA--
return array()
return []
--EXPECT--
-2
0
+1 -1
View File
@@ -14,7 +14,7 @@
{{ number5|abs }}
{{ number6|abs }}
--DATA--
return array('number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5)
return ['number1' => -5.5, 'number2' => -5, 'number3' => -0, 'number4' => 0, 'number5' => 5, 'number6' => 5.5]
--EXPECT--
5.5
5
+1 -1
View File
@@ -9,7 +9,7 @@
</div>
{% endfor %}
--DATA--
return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'))
return ['items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')]
--EXPECT--
<div class=row>
<div class=item>a</div>
@@ -9,7 +9,7 @@
</div>
{% endfor %}
--DATA--
return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'))
return ['items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')]
--EXPECT--
<div class=row>
<div class=item>a</div>
@@ -11,7 +11,7 @@
{% endfor %}
</table>
--DATA--
return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'))
return ['items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')]
--EXPECT--
<table>
<tr>
@@ -9,7 +9,7 @@
</div>
{% endfor %}
--DATA--
return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'))
return ['items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l')]
--EXPECT--
<div class=row>
<div class=item>a</div>
@@ -11,7 +11,7 @@
{% endfor %}
</table>
--DATA--
return array('items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j'))
return ['items' => array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j')]
--EXPECT--
<table>
<tr>
@@ -4,7 +4,7 @@
{{ {'foo': 'bar', 'key': 'value'}|batch(4)|first|keys|join(',') }}
{{ {'foo': 'bar', 'key': 'value'}|batch(4, 'fill')|first|keys|join(',') }}
--DATA--
return array()
return []
--EXPECT--
foo,key
foo,key,0,1
@@ -4,7 +4,7 @@
{{ []|batch(3)|length }}
{{ []|batch(3, 'fill')|length }}
--DATA--
return array()
return []
--EXPECT--
0
0
@@ -5,6 +5,6 @@ function_exists('iconv') || function_exists('mb_convert_encoding')
--TEMPLATE--
{{ "愛していますか?"|convert_encoding('ISO-2022-JP', 'UTF-8')|convert_encoding('UTF-8', 'ISO-2022-JP') }}
--DATA--
return array()
return []
--EXPECT--
愛していますか?
@@ -6,7 +6,7 @@
{{ date|date('d/m/Y H:i:s P', timezone='America/Chicago') }}
--DATA--
date_default_timezone_set('UTC');
return array('date' => mktime(13, 45, 0, 10, 4, 2010))
return ['date' => mktime(13, 45, 0, 10, 4, 2010)]
--EXPECT--
04/10/2010 08:45:00 -05:00
04/10/2010 08:45:00 -05:00
@@ -54,7 +54,7 @@ return array(
'object' => new TwigTestFoo(),
)
--CONFIG--
return array('strict_variables' => false)
return ['strict_variables' => false]
--EXPECT--
Variable:
ok
@@ -109,7 +109,7 @@ return array(
'object' => new TwigTestFoo(),
)
--CONFIG--
return array('strict_variables' => true)
return ['strict_variables' => true]
--EXPECT--
Variable:
ok
@@ -4,7 +4,7 @@ dynamic filter
{{ 'bar'|foo_path }}
{{ 'bar'|a_foo_b_bar }}
--DATA--
return array()
return []
--EXPECT--
foo/bar
a/b/bar
+1 -1
View File
@@ -3,6 +3,6 @@
--TEMPLATE--
{{ "foo <br />"|e }}
--DATA--
return array()
return []
--EXPECT--
foo &lt;br /&gt;
@@ -3,6 +3,6 @@
--TEMPLATE--
{{ '<br />'|escape('html_attr') }}
--DATA--
return array()
return []
--EXPECT--
&lt;br&#x20;&#x2F;&gt;
@@ -3,6 +3,6 @@
--TEMPLATE--
{{ "é ♜ 𝌆"|e('js') }}
--DATA--
return array()
return []
--EXPECT--
\u00E9\u0020\u265C\u0020\uD834\uDF06
@@ -3,6 +3,6 @@
--TEMPLATE--
{{ "愛していますか? <br />"|e }}
--DATA--
return array()
return []
--EXPECT--
愛していますか? &lt;br /&gt;
+1 -1
View File
@@ -8,7 +8,7 @@
{{ 'Ä€é'|first }}
{{ ''|first }}
--DATA--
return array('arr' => new ArrayObject(array(1, 2, 3, 4)))
return ['arr' => new ArrayObject(array(1, 2, 3, 4))]
--EXPECT--
1
1
@@ -11,7 +11,7 @@
{{ foo }}
{% endautoescape %}
--DATA--
return array()
return []
--EXPECT--
foo&lt;br /&gt;
\u0020\u0020\u0020\u0020foo\u003Cbr\u0020\/\u003E\n
+1 -1
View File
@@ -3,6 +3,6 @@
--TEMPLATE--
{{ string|format(foo, 3) }}
--DATA--
return array('string' => '%s/%d', 'foo' => 'bar')
return ['string' => '%s/%d', 'foo' => 'bar']
--EXPECT--
bar/3
+1 -1
View File
@@ -18,7 +18,7 @@
{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',') }}
{{ {"a": "w", "b": "x", "c": "y", "d": "z"}|join(',','-') }}
--DATA--
return array('foo' => new TwigTestFoo(), 'bar' => new ArrayObject(array(3, 4)))
return ['foo' => new TwigTestFoo(), 'bar' => new ArrayObject(array(3, 4))]
--EXPECT--
foo, bar
1, 2
@@ -5,7 +5,7 @@
{{ foo|json_encode|raw }}
{{ [foo, "foo"]|json_encode|raw }}
--DATA--
return array('foo' => new Twig_Markup('foo', 'UTF-8'))
return ['foo' => new Twig_Markup('foo', 'UTF-8')]
--EXPECT--
"foo"
"foo"
+1 -1
View File
@@ -8,7 +8,7 @@
{{ 'Ä€é'|last }}
{{ ''|last }}
--DATA--
return array('arr' => new ArrayObject(array(1, 2, 3, 4)))
return ['arr' => new ArrayObject(array(1, 2, 3, 4))]
--EXPECT--
4
4
@@ -6,7 +6,7 @@ function_exists('mb_get_info')
{{ string|length }}
{{ markup|length }}
--DATA--
return array('string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8'))
return ['string' => 'été', 'markup' => new Twig_Markup('foo', 'UTF-8')]
--EXPECT--
3
3
+1 -1
View File
@@ -8,7 +8,7 @@
{{ numerics|merge([4, 5, 6])|join }}
{{ traversable.a|merge(traversable.b)|join }}
--DATA--
return array('items' => array('foo' => 'bar'), 'numerics' => array(1, 2, 3), 'traversable' => array('a' => new ArrayObject(array(0 => 1, 1 => 2, 2 => 3)), 'b' => new ArrayObject(array('a' => 'b'))))
return ['items' => array('foo' => 'bar'), 'numerics' => array(1, 2, 3), 'traversable' => array('a' => new ArrayObject(array(0 => 1, 1 => 2, 2 => 3)), 'b' => new ArrayObject(array('a' => 'b')))]
--EXPECT--
barfoo
foobar
+1 -1
View File
@@ -4,7 +4,7 @@
{{ "I like Twig.\nYou will like it too.\n\nEverybody like it!"|nl2br }}
{{ text|nl2br }}
--DATA--
return array('text' => "If you have some <strong>HTML</strong>\nit will be escaped.")
return ['text' => "If you have some <strong>HTML</strong>\nit will be escaped."]
--EXPECT--
I like Twig.<br />
You will like it too.<br />
@@ -8,7 +8,7 @@
{{ 1020.25|number_format(2, ',') }}
{{ 1020.25|number_format(2, ',', '.') }}
--DATA--
return array();
return []
--EXPECT--
20
20
@@ -10,7 +10,7 @@
{{ 1020.25|number_format(2, ',', '.') }}
--DATA--
$twig->getExtension('Twig_Extension_Core')->setNumberFormat(2, '!', '=');
return array();
return []
--EXPECT--
20!00
20!25
@@ -5,7 +5,7 @@
{{ 'I like single replace operation only %that%'|replace({'%that%' : '%that%1'}) }}
{{ 'I like %this% and %that%.'|replace(traversable) }}
--DATA--
return array('traversable' => new ArrayObject(array('%this%' => 'foo', '%that%' => 'bar')))
return ['traversable' => new ArrayObject(array('%this%' => 'foo', '%that%' => 'bar'))]
--EXPECT--
I liké foo and bar.
I like single replace operation only %that%1
@@ -3,6 +3,6 @@ Exception for invalid argument type in replace call
--TEMPLATE--
{{ 'test %foo%'|replace(stdClass) }}
--DATA--
return array('stdClass' => new stdClass())
return ['stdClass' => new stdClass()]
--EXCEPTION--
Twig_Error_Runtime: The "replace" filter expects an array or "Traversable" as replace values, got "stdClass" in "index.twig" at line 2.
@@ -8,7 +8,7 @@
{{ {'a': 'c', 'b': 'a'}|reverse(preserveKeys=true)|join(glue=',') }}
{{ {'a': 'c', 'b': 'a'}|reverse(preserve_keys=true)|join(glue=',') }}
--DATA--
return array('arr' => new ArrayObject(array(1, 2, 3, 4)))
return ['arr' => new ArrayObject(array(1, 2, 3, 4))]
--EXPECT--
4321
tnemenèvé4321
+1 -1
View File
@@ -10,7 +10,7 @@
{{ 21.3|round(-1, 'ceil')}}
{{ 21.3|round(-1, 'floor')}}
--DATA--
return array()
return []
--EXPECT--
3
2
+1 -1
View File
@@ -26,7 +26,7 @@
{{ arr[2:]|join('') }}
{{ xml|slice(1)|join('')}}
--DATA--
return array('start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4)), 'xml' => new SimpleXMLElement('<items><item>1</item><item>2</item></items>'))
return ['start' => 1, 'length' => 2, 'arr' => new ArrayObject(array(1, 2, 3, 4)), 'xml' => new SimpleXMLElement('<items><item>1</item><item>2</item></items>')]
--EXPECT--
23
23
+1 -1
View File
@@ -5,7 +5,7 @@
{{ array2|sort|join }}
{{ traversable|sort|join }}
--DATA--
return array('array1' => array(4, 1), 'array2' => array('foo', 'bar'), 'traversable' => new ArrayObject(array(0 => 3, 1 => 2, 2 => 1)))
return ['array1' => array(4, 1), 'array2' => array('foo', 'bar'), 'traversable' => new ArrayObject(array(0 => 3, 1 => 2, 2 => 1))]
--EXPECT--
14
barfoo
@@ -3,6 +3,6 @@
--TEMPLATE--
{{ 'foo'|§ }}
--DATA--
return array()
return []
--EXPECT--
§foo§
+1 -1
View File
@@ -9,7 +9,7 @@
{{ baz|split('', 2)|join('-') }}
{{ foo|split(',', -2)|join('-') }}
--DATA--
return array('foo' => "one,two,three,four,five", 'baz' => '12345',)
return ['foo' => "one,two,three,four,five", 'baz' => '12345',]
--EXPECT--
one-two-three-four-five
one-two-three-four-five
@@ -12,7 +12,7 @@ function_exists('mb_get_info')
{{ baz|split('', 1)|join('-') }}
{{ baz|split('', 2)|join('-') }}
--DATA--
return array('foo' => 'Ä,é,Äほ', 'baz' => 'éÄßごa',)
return ['foo' => 'Ä,é,Äほ', 'baz' => 'éÄßごa',]
--EXPECT--
é
Ä-é-Äほ
@@ -4,7 +4,7 @@ Filters as static method calls
{{ 'foo'|static_call_string }}
{{ 'foo'|static_call_array }}
--DATA--
return array('foo' => 'foo')
return ['foo' => 'foo']
--EXPECT--
*foo*
*foo*
+1 -1
View File
@@ -11,7 +11,7 @@
{{ "/ foo/"|trim(character_mask="/", side="left") }}
{{ " do nothing. "|trim("", "right") }}
--DATA--
return array('text' => " If you have some <strong>HTML</strong> it will be escaped. ")
return ['text' => " If you have some <strong>HTML</strong> it will be escaped. "]
--EXPECT--
I like Twig.
If you have some &lt;strong&gt;HTML&lt;/strong&gt; it will be escaped.
@@ -8,7 +8,7 @@ defined('PHP_QUERY_RFC3986')
{{ {}|url_encode|default("default") }}
{{ 'spéßi%le%c0d@dspa ce'|url_encode }}
--DATA--
return array()
return []
--EXPECT--
foo=bar&amp;number=3&amp;sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&amp;spa%20ce=
foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
@@ -8,7 +8,7 @@ defined('PHP_QUERY_RFC3986')
{{ {}|url_encode|default("default") }}
{{ 'spéßi%le%c0d@dspa ce'|url_encode }}
--DATA--
return array()
return []
--EXPECT--
foo=bar&amp;number=3&amp;sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&amp;spa%20ce=
foo=bar&number=3&sp%C3%A9%C3%9Fi%25l=e%25c0d%40d&spa%20ce=
@@ -8,7 +8,7 @@
{{ attribute(obj, method) is defined ? 'ok' : 'ko' }}
{{ attribute(obj, nonmethod) is defined ? 'ok' : 'ko' }}
--DATA--
return array('obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => array('a', 'b'))
return ['obj' => new TwigTestFoo(), 'method' => 'foo', 'array' => array('foo' => 'bar'), 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => array('a', 'b')]
--EXPECT--
foo
bar
@@ -7,6 +7,6 @@
{% block foo %}{{ block('bar') }}{% endblock %}
{% block bar %}BAR_BASE{% endblock %}
--DATA--
return array()
return []
--EXPECT--
BARBAR
@@ -7,6 +7,6 @@
{% block foo %}{{ block() }}{% endblock %}
{% block bar %}BAR_BASE{% endblock %}
--DATA--
return array()
return []
--EXCEPTION--
Twig_Error_Syntax: The "block" function takes one argument (the block name) in "base.twig" at line 2.
@@ -4,7 +4,7 @@
{{ constant('DATE_W3C') == expect ? 'true' : 'false' }}
{{ constant('ARRAY_AS_PROPS', object) }}
--DATA--
return array('expect' => DATE_W3C, 'object' => new ArrayObject(array('hi')));
return ['expect' => DATE_W3C, 'object' => new ArrayObject(array('hi'))]
--EXPECT--
true
2
@@ -5,7 +5,7 @@
{{ cycle(array1, i) }}-{{ cycle(array2, i) }}
{% endfor %}
--DATA--
return array('array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus'))
return ['array1' => array('odd', 'even'), 'array2' => array('apple', 'orange', 'citrus')]
--EXPECT--
odd-apple
even-orange
@@ -5,7 +5,7 @@
{{ date(timezone="America/New_York", date=date)|date('d/m/Y H:i:s P', false) }}
--DATA--
date_default_timezone_set('UTC');
return array('date' => mktime(13, 45, 0, 10, 4, 2010))
return ['date' => mktime(13, 45, 0, 10, 4, 2010)]
--EXPECT--
04/10/2010 09:45:00 -04:00
04/10/2010 09:45:00 -04:00
+2 -2
View File
@@ -6,9 +6,9 @@
{{ dump('foo') }}
{{ dump('foo', 'bar') }}
--DATA--
return array('foo' => 'foo', 'bar' => 'bar')
return ['foo' => 'foo', 'bar' => 'bar']
--CONFIG--
return array('debug' => true, 'autoescape' => false);
return ['debug' => true, 'autoescape' => false]
--EXPECT--
string(3) "foo"
@@ -5,9 +5,9 @@
--TEMPLATE--
{{ dump() }}
--DATA--
return array('foo' => 'foo', 'bar' => 'bar')
return ['foo' => 'foo', 'bar' => 'bar']
--CONFIG--
return array('debug' => true, 'autoescape' => false);
return ['debug' => true, 'autoescape' => false]
--EXPECT--
array(3) {
["foo"]=>
@@ -4,7 +4,7 @@ dynamic function
{{ foo_path('bar') }}
{{ a_foo_b_bar('bar') }}
--DATA--
return array()
return []
--EXPECT--
foo/bar
a/b/bar
@@ -7,7 +7,7 @@ FOO{{ tmp }}BAR
--TEMPLATE(foo.twig)--
FOOBAR
--DATA--
return array()
return []
--EXPECT--
FOO
FOOBARBAR
@@ -5,6 +5,6 @@
--TEMPLATE(foo.twig)--
<p>Test</p>
--DATA--
return array()
return []
--EXPECT--
<p>Test</p>
@@ -8,7 +8,7 @@ BAR
--TEMPLATE(foo.twig)--
FOOBAR
--DATA--
return array()
return []
--EXPECT--
FOO
@@ -8,7 +8,7 @@ BAR
--TEMPLATE(foo.twig)--
FOOBAR
--DATA--
return array('foo' => 'foo.twig')
return ['foo' => 'foo.twig']
--EXPECT--
FOO
@@ -6,5 +6,5 @@
{{ include("foo.twig", ignore_missing = true, variables = {}) }}
{{ include("foo.twig", ignore_missing = true, variables = {}, with_context = true) }}
--DATA--
return array()
return []
--EXPECT--
@@ -3,6 +3,6 @@
--TEMPLATE--
{{ include("foo.twig") }}
--DATA--
return array();
return []
--EXCEPTION--
Twig_Error_Loader: Template "foo.twig" is not defined in "index.twig" at line 2.
@@ -11,6 +11,6 @@
{{ include("foo.twig") }}
{% endblock %}
--DATA--
return array();
return []
--EXCEPTION--
Twig_Error_Loader: Template "foo.twig" is not defined in "base.twig" at line 3.
@@ -8,6 +8,6 @@
{{ foo|e }}
{{ foo|e }}
--DATA--
return array()
return []
--EXCEPTION--
Twig_Sandbox_SecurityNotAllowedFilterError: Filter "e" is not allowed in "foo.twig" at line 4.
@@ -8,7 +8,7 @@ foo
--TEMPLATE(bar.twig)--
{{ foo|e }}
--DATA--
return array('foo' => 'bar<br />')
return ['foo' => 'bar<br />']
--EXPECT--
foo
@@ -6,7 +6,7 @@
--TEMPLATE(bar.twig)--
{{ foo|e }}
--DATA--
return array('foo' => 'bar<br />')
return ['foo' => 'bar<br />']
--EXPECT--
@@ -5,6 +5,6 @@
--TEMPLATE(foo.twig)--
BAR
--DATA--
return array('foo' => $twig->loadTemplate('foo.twig'))
return ['foo' => $twig->loadTemplate('foo.twig')]
--EXPECT--
BAR FOO
@@ -6,7 +6,7 @@
--TEMPLATE(foo.twig)--
foo
--DATA--
return array()
return []
--EXPECT--
foo
foo
@@ -8,7 +8,7 @@
--TEMPLATE(foo.twig)--
{% for k, v in _context %}{{ k }},{% endfor %}
--DATA--
return array('foo' => 'bar')
return ['foo' => 'bar']
--EXPECT--
foo,global,_parent,
global,_parent,
@@ -6,7 +6,7 @@
--TEMPLATE(foo.twig)--
{{ foo }}
--DATA--
return array('vars' => array('foo' => 'bar'))
return ['vars' => array('foo' => 'bar')]
--EXPECT--
bar
bar
@@ -3,6 +3,6 @@ __call calls
--TEMPLATE--
{{ 'foo'|magic_call }}
--DATA--
return array()
return []
--EXPECT--
magic_foo
@@ -6,7 +6,7 @@ version_compare(phpversion(), '5.3.0', '>=')
{{ 'foo'|magic_call_string }}
{{ 'foo'|magic_call_array }}
--DATA--
return array()
return []
--EXPECT--
static_magic_foo
static_magic_foo

Some files were not shown because too many files have changed in this diff Show More