diff --git a/tests/bootstrap.php b/tests/bootstrap.php
index 3be9ba2..022f6c2 100644
--- a/tests/bootstrap.php
+++ b/tests/bootstrap.php
@@ -35,7 +35,35 @@ class simplexml_dump_bootstrap extends PHPUnit_Framework_TestCase
');
- $this->simpleXML_NS = simplexml_load_string('
+ $this->simpleXML_default_NS = simplexml_load_string('
+
+
+ PHP: Behind the Parser
+
+
+ Ms. Coder
+ Onlivia Actora
+
+
+ Mr. Coder
+ El ActÓr
+
+
+
+ So, this language. It\'s like, a programming language.
+ Or is it a scripting language? All is revealed in this
+ thrilling horror spoof of a documentary.
+
+
+ PHP solves all my web problems
+
+ 7
+ 5
+
+
+ ');
+
+ $this->simpleXML_named_NS = simplexml_load_string('
PHP: Behind the Parser
diff --git a/tests/simplexml_dump_Test.php b/tests/simplexml_dump_Test.php
index 741316c..5dd7610 100644
--- a/tests/simplexml_dump_Test.php
+++ b/tests/simplexml_dump_Test.php
@@ -18,7 +18,25 @@ class simplexml_dump_Test extends simplexml_dump_bootstrap
]
";
- $this->expected_NS = "SimpleXML object (1 item)
+ $this->expected_default_NS = "SimpleXML object (1 item)
+[
+ Element {
+ Namespace: 'https://github.com/IMSoP/simplexml_debug'
+ (Default Namespace)
+ Name: 'movies'
+ String Content: '
+
+ '
+ Content in Default Namespace
+ Namespace URI: 'https://github.com/IMSoP/simplexml_debug'
+ Children: 1 - 1 'movie'
+ Attributes: 0
+ }
+]
+";
+
+
+ $this->expected_named_NS = "SimpleXML object (1 item)
[
Element {
Name: 'movies'
@@ -52,13 +70,19 @@ class simplexml_dump_Test extends simplexml_dump_bootstrap
$this->assertEquals($this->expected, $return);
}
- public function testDumpWithNS()
+ public function testDumpWithDefaultNS()
{
- $return = simplexml_dump($this->simpleXML_NS, true);
- $this->assertEquals($this->expected_NS, $return);
+ $return = simplexml_dump($this->simpleXML_default_NS, true);
+ $this->assertEquals($this->expected_default_NS, $return);
}
- public function testDumpWithSingleNodeWithAttributesAndNS()
+ public function testDumpWithNamedNS()
+ {
+ $return = simplexml_dump($this->simpleXML_named_NS, true);
+ $this->assertEquals($this->expected_named_NS, $return);
+ }
+
+ public function testDumpAttributeWithNamedNS()
{
$xml = '';
$sxml = simplexml_load_string($xml);
@@ -74,6 +98,31 @@ class simplexml_dump_Test extends simplexml_dump_bootstrap
Value: 'bar'
}
]
+";
+
+ $this->assertEquals($expected, $return);
+ }
+
+ public function testDumpMultipleAttributes()
+ {
+ $xml = '';
+ $sxml = simplexml_load_string($xml);
+
+ $return = simplexml_dump($sxml->child, true);
+
+ $expected = "SimpleXML object (1 item)
+[
+ Element {
+ Namespace: 'ns'
+ Namespace Alias: 'ns'
+ Name: 'child'
+ String Content: ''
+ Content in Namespace ns
+ Namespace URI: 'ns'
+ Children: 0
+ Attributes: 3 - 'one', 'two', 'three'
+ }
+]
";
$this->assertEquals($expected, $return);