diff --git a/tests/Parser/XmlTest.php b/tests/Parser/XmlTest.php index 37b1a91..2f6a0eb 100644 --- a/tests/Parser/XmlTest.php +++ b/tests/Parser/XmlTest.php @@ -62,4 +62,21 @@ public function testLoadXml() $this->assertEquals('localhost', $string['host']); $this->assertEquals('80', $string['port']); } + + /** + * @covers Noodlehaus\Parser\Xml::parseFile() + * @covers Noodlehaus\Parser\Xml::parseString() + * @covers Noodlehaus\Parser\Xml::parse() + */ + public function testLoadXmlWithAttributes() + { + $file = $this->xml->parseFile(__DIR__ . '/../mocks/pass/config-with-attributes.xml'); + $string = $this->xml->parseString(file_get_contents(__DIR__ . '/../mocks/pass/config-with-attributes.xml')); + + $this->assertEquals('localhost', $file['host']); + $this->assertEquals('80', $file['port']); + + $this->assertEquals('localhost', $string['host']); + $this->assertEquals('80', $string['port']); + } } diff --git a/tests/mocks/pass/config-with-attributes.xml b/tests/mocks/pass/config-with-attributes.xml new file mode 100644 index 0000000..f018a60 --- /dev/null +++ b/tests/mocks/pass/config-with-attributes.xml @@ -0,0 +1,14 @@ + + + + configuration + s3cr3t + + localhost + 80 + + host1 + host2 + host3 + + \ No newline at end of file