public function testConvertDomElementToArray() {
$doc = new \DOMDocument("1.0");
$doc
->loadXML('<foo>bar</foo>');
$this
->assertEquals('bar', XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc
->loadXML('<foo foo="bar" />');
$this
->assertEquals(array(
'foo' => 'bar',
), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc
->loadXML('<foo><foo>bar</foo></foo>');
$this
->assertEquals(array(
'foo' => 'bar',
), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc
->loadXML('<foo><foo>bar<foo>bar</foo></foo></foo>');
$this
->assertEquals(array(
'foo' => array(
'value' => 'bar',
'foo' => 'bar',
),
), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc
->loadXML('<foo><foo></foo></foo>');
$this
->assertEquals(array(
'foo' => null,
), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc
->loadXML('<foo><foo><!-- foo --></foo></foo>');
$this
->assertEquals(array(
'foo' => null,
), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array');
$doc = new \DOMDocument("1.0");
$doc
->loadXML('<foo><foo foo="bar"/><foo foo="bar"/></foo>');
$this
->assertEquals(array(
'foo' => array(
array(
'foo' => 'bar',
),
array(
'foo' => 'bar',
),
),
), XmlFileLoader::convertDomElementToArray($doc->documentElement), '::convertDomElementToArray() converts a \\DomElement to an array');
}