Skip to content

Commit

Permalink
- Test undefined index #
Browse files Browse the repository at this point in the history
  • Loading branch information
egulias authored and fabpot committed Dec 12, 2012
1 parent b73b87d commit b4e894a
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,39 @@ public function testDecodeArray()
$this->assertEquals($expected, $this->encoder->decode($source, 'xml'));
}

public function testDecodeWithoutItemHash()
{
$obj = new ScalarDummy;
$obj->xmlFoo = array(
'foo-bar' => array(
'@key' => "value",
'item' => array("@key" => 'key', "key-val" => 'val')
),
'Foo' => array(
'Bar' => "Test",
'@Type' => 'test'
),
'föo_bär' => 'a',
"Bar" => array(1,2,3),
'a' => 'b',
);
$expected = array(
'foo-bar' => array(
'@key' => "value",
'key' => array('@key' => 'key', "key-val" => 'val')
),
'Foo' => array(
'Bar' => "Test",
'@Type' => 'test'
),
'föo_bär' => 'a',
"Bar" => array(1,2,3),
'a' => 'b',
);
$xml = $this->encoder->encode($obj, 'xml');
$this->assertEquals($expected, $this->encoder->decode($xml, 'xml'));
}

public function testPreventsComplexExternalEntities()
{
$oldCwd = getcwd();
Expand Down

0 comments on commit b4e894a

Please sign in to comment.