diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..3be9ba2 --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,68 @@ +simpleXML = 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_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 + + + '); + } +} + +?> diff --git a/tests/simplexml_dump_Test.php b/tests/simplexml_dump_Test.php new file mode 100644 index 0000000..d29506f --- /dev/null +++ b/tests/simplexml_dump_Test.php @@ -0,0 +1,62 @@ +expected = "SimpleXML object (1 item) +[ + Element { + Name: 'movies' + String Content: ' + + ' + Content in Default Namespace + Children: 1 - 1 'movie' + Attributes: 0 + } +] +"; + + $this->expected_NS = "SimpleXML object (1 item) +[ + Element { + Name: 'movies' + String Content: ' + + ' + Content in Namespace test + Namespace URI: 'https://github.com/IMSoP/simplexml_debug' + Children: 1 - 1 'movie' + Attributes: 0 + } +] +"; + + parent::setUp(); + } + + public function testDump() + { + ob_start(); + simplexml_dump($this->simpleXML); + $return = ob_get_contents(); + ob_end_clean(); + + $this->assertEquals($this->expected, $return); + } + + public function testDumpReturn() + { + $return = simplexml_dump($this->simpleXML, true); + $this->assertEquals($this->expected, $return); + } + + public function testDumpWithNS() + { + $return = simplexml_dump($this->simpleXML_NS, true); + $this->assertEquals($this->expected_NS, $return); + } +} + +?> diff --git a/tests/simplexml_tree_Test.php b/tests/simplexml_tree_Test.php new file mode 100644 index 0000000..e69de29