public function XmlFileLoaderTest::testConvertDomElementToArray in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\XmlFileLoaderTest::testConvertDomElementToArray()
File
- vendor/
symfony/ dependency-injection/ Tests/ Loader/ XmlFileLoaderTest.php, line 271
Class
Namespace
Symfony\Component\DependencyInjection\Tests\LoaderCode
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');
}