mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 03:46:39 +00:00
25 lines
607 B
Plaintext
25 lines
607 B
Plaintext
--TEST--
|
|
"." notation with dynamic attributes
|
|
--TEMPLATE--
|
|
{{ obj.(method) }}
|
|
{{ array.(item) }}
|
|
{{ obj.("bar")("a", "b") }}
|
|
{{ obj.("bar")(param1: "a", param2: "b") }}
|
|
{{ obj.("bar")(param2: "b", param1: "a") }}
|
|
{{ obj.("bar")("a", param2: "b") }}
|
|
{{ obj.("bar")(...arguments) }}
|
|
{{ obj.(method) is defined ? 'ok' : 'ko' }}
|
|
{{ obj.(nonmethod) is defined ? 'ok' : 'ko' }}
|
|
--DATA--
|
|
return ['obj' => new Twig\Tests\TwigTestFoo(), 'method' => 'foo', 'array' => ['foo' => 'bar'], 'item' => 'foo', 'nonmethod' => 'xxx', 'arguments' => ['a', 'b']]
|
|
--EXPECT--
|
|
foo
|
|
bar
|
|
bar_a-b
|
|
bar_a-b
|
|
bar_a-b
|
|
bar_a-b
|
|
bar_a-b
|
|
ok
|
|
ko
|