mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 19:36:43 +00:00
20 lines
536 B
Plaintext
20 lines
536 B
Plaintext
--TEST--
|
|
Twig is able to deal with SimpleXMLElement instances as variables
|
|
--CONDITION--
|
|
version_compare(phpversion(), '8.0', '<')
|
|
--TEMPLATE--
|
|
Hello '{{ images.image.0.group }}'!
|
|
{{ images.image.0.group.attributes.myattr }}
|
|
{{ images.children().image.count() }}
|
|
{% for image in images %}
|
|
- {{ image.group }}
|
|
{% endfor %}
|
|
--DATA--
|
|
return ['images' => new \SimpleXMLElement('<images><image><group myattr="example">foo</group></image><image><group>bar</group></image></images>')]
|
|
--EXPECT--
|
|
Hello 'foo'!
|
|
example
|
|
2
|
|
- foo
|
|
- bar
|