Skip to content

Commit eb10da9

Browse files
committed
IHF: xml_to_array attributes added.
1 parent f858c73 commit eb10da9

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

tests/xml/XmlToArrayTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,25 @@ public function it_transforms_xml_string_to_array()
1414
'to' => 'John',
1515
'from' => 'Jane',
1616
'title' => 'Go to the shop',
17+
'@attributes' => [
18+
'priority' => 'low',
19+
],
1720
],
1821
1 => [
1922
'to' => 'John',
2023
'from' => 'Paul',
2124
'title' => 'Finish the report',
25+
'@attributes' => [
26+
'priority' => 'medium',
27+
],
2228
],
2329
2 => [
2430
'to' => 'Jane',
2531
'from' => 'Jeff',
2632
'title' => 'Clean the house',
33+
'@attributes' => [
34+
'priority' => 'high',
35+
],
2736
],
2837
],
2938
],
@@ -44,16 +53,25 @@ public function it_also_allows_to_pass_simplexmlelement_object()
4453
'to' => 'John',
4554
'from' => 'Jane',
4655
'title' => 'Go to the shop',
56+
'@attributes' => [
57+
'priority' => 'low',
58+
],
4759
],
4860
1 => [
4961
'to' => 'John',
5062
'from' => 'Paul',
5163
'title' => 'Finish the report',
64+
'@attributes' => [
65+
'priority' => 'medium',
66+
],
5267
],
5368
2 => [
5469
'to' => 'Jane',
5570
'from' => 'Jeff',
5671
'title' => 'Clean the house',
72+
'@attributes' => [
73+
'priority' => 'high',
74+
],
5775
],
5876
],
5977
],

tests/xml/XmlToArrayTest/example.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<root>
33
<tasks>
4-
<task>
4+
<task priority="low">
55
<to>John</to>
66
<from>Jane</from>
77
<title>Go to the shop</title>
88
</task>
9-
<task>
9+
<task priority="medium">
1010
<to>John</to>
1111
<from>Paul</from>
1212
<title>Finish the report</title>
1313
</task>
14-
<task>
14+
<task priority="high">
1515
<to>Jane</to>
1616
<from>Jeff</from>
1717
<title>Clean the house</title>

0 commit comments

Comments
 (0)