Skip to content

Commit c3a7a60

Browse files
eguliasfabpot
authored andcommitted
- Test undefined index #
1 parent 07e9222 commit c3a7a60

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Tests/Encoder/XmlEncoderTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,39 @@ public function testDecodeArray()
251251
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
252252
}
253253

254+
public function testDecodeWithoutItemHash()
255+
{
256+
$obj = new ScalarDummy;
257+
$obj->xmlFoo = array(
258+
'foo-bar' => array(
259+
'@key' => "value",
260+
'item' => array("@key" => 'key', "key-val" => 'val')
261+
),
262+
'Foo' => array(
263+
'Bar' => "Test",
264+
'@Type' => 'test'
265+
),
266+
'föo_bär' => 'a',
267+
"Bar" => array(1,2,3),
268+
'a' => 'b',
269+
);
270+
$expected = array(
271+
'foo-bar' => array(
272+
'@key' => "value",
273+
'key' => array('@key' => 'key', "key-val" => 'val')
274+
),
275+
'Foo' => array(
276+
'Bar' => "Test",
277+
'@Type' => 'test'
278+
),
279+
'föo_bär' => 'a',
280+
"Bar" => array(1,2,3),
281+
'a' => 'b',
282+
);
283+
$xml = $this->encoder->encode($obj, 'xml');
284+
$this->assertEquals($expected, $this->encoder->decode($xml, 'xml'));
285+
}
286+
254287
public function testPreventsComplexExternalEntities()
255288
{
256289
$oldCwd = getcwd();

0 commit comments

Comments
 (0)