From 48d0ba896b7b0368a77f6c54cd53be9098a2e547 Mon Sep 17 00:00:00 2001 From: Sander Marechal Date: Sat, 19 Oct 2013 16:07:47 +0200 Subject: [PATCH] Added failing unittest for XML namespaces --- .../Tests/Fixtures/xml/namespaces.xml | 17 +++++++++++++++++ .../Tests/Loader/XmlFileLoaderTest.php | 12 ++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml new file mode 100644 index 0000000000000..5a05cedd7e79e --- /dev/null +++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/namespaces.xml @@ -0,0 +1,17 @@ + + + + + + + + + foo + + + + diff --git a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php index 6d36e2404c157..054a970318e69 100644 --- a/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php +++ b/src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php @@ -405,4 +405,16 @@ public function testDocTypeIsNotAllowed() $this->assertSame('Document types are not allowed.', $e->getMessage(), '->load() throws an InvalidArgumentException if the configuration contains a document type'); } } + + public function testXmlNamespaces() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('namespaces.xml'); + $services = $container->getDefinitions(); + + $this->assertTrue(isset($services['foo']), '->load() parses elements'); + $this->assertEquals(1, count($services['foo']->getTag('foo.tag')), '->load parses elements'); + $this->assertEquals(array(array('setBar', array('foo'))), $services['foo']->getMethodCalls(), '->load() parses the tag'); + } }