@@ -96,4 +96,29 @@ public function testZF300_ArraysWithMultipleChildren()
9696 $ this ->assertEquals ('2 ' , $ config ['six ' ]['seven ' ][1 ]['nine ' ]);
9797 $ this ->assertEquals ('3 ' , $ config ['six ' ]['seven ' ][2 ]['nine ' ]);
9898 }
99+
100+ /**
101+ * @group zf6279
102+ */
103+ public function testElementWithBothAttributesAndAStringValueIsProcessedCorrectly ()
104+ {
105+ $ this ->reader = new Xml ();
106+ $ arrayXml = $ this ->reader ->fromFile ($ this ->getTestAssetPath ('attributes ' ));
107+ $ this ->assertArrayHasKey ('one ' , $ arrayXml );
108+ $ this ->assertInternalType ('array ' , $ arrayXml ['one ' ]);
109+
110+ // No attribute + text value == string
111+ $ this ->assertArrayHasKey (0 , $ arrayXml ['one ' ]);
112+ $ this ->assertEquals ('bazbat ' , $ arrayXml ['one ' ][0 ]);
113+
114+ // Attribute(s) + text value == array
115+ $ this ->assertArrayHasKey (1 , $ arrayXml ['one ' ]);
116+ $ this ->assertInternalType ('array ' , $ arrayXml ['one ' ][1 ]);
117+ // Attributes stored in named array keys
118+ $ this ->assertArrayHasKey ('foo ' , $ arrayXml ['one ' ][1 ]);
119+ $ this ->assertEquals ('bar ' , $ arrayXml ['one ' ][1 ]['foo ' ]);
120+ // Element value stored in special key '_'
121+ $ this ->assertArrayHasKey ('_ ' , $ arrayXml ['one ' ][1 ]);
122+ $ this ->assertEquals ('bazbat ' , $ arrayXml ['one ' ][1 ]['_ ' ]);
123+ }
99124}
0 commit comments