public function XmlFileLoaderTest::testConvertDomElementToArray in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php \Symfony\Component\DependencyInjection\Tests\Loader\XmlFileLoaderTest::testConvertDomElementToArray()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Loader/ XmlFileLoaderTest.php, line 273
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');
}