mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-15 20:06:31 +00:00
added test for accessing xml attributes
This commit is contained in:
@@ -4,14 +4,16 @@ Twig is able to deal with SimpleXMLElement instances as variables
|
|||||||
version_compare(phpversion(), '5.3.0', '>=')
|
version_compare(phpversion(), '5.3.0', '>=')
|
||||||
--TEMPLATE--
|
--TEMPLATE--
|
||||||
Hello '{{ images.image.0.group }}'!
|
Hello '{{ images.image.0.group }}'!
|
||||||
|
{{ images.image.0.group.attributes.myattr }}
|
||||||
{{ images.children().image.count() }}
|
{{ images.children().image.count() }}
|
||||||
{% for image in images %}
|
{% for image in images %}
|
||||||
- {{ image.group }}
|
- {{ image.group }}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
--DATA--
|
--DATA--
|
||||||
return array('images' => new SimpleXMLElement('<images><image><group>foo</group></image><image><group>bar</group></image></images>'))
|
return array('images' => new SimpleXMLElement('<images><image><group myattr="example">foo</group></image><image><group>bar</group></image></images>'))
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
Hello 'foo'!
|
Hello 'foo'!
|
||||||
|
example
|
||||||
2
|
2
|
||||||
- foo
|
- foo
|
||||||
- bar
|
- bar
|
||||||
|
|||||||
Reference in New Issue
Block a user