From 193ae05eddd0f7f60fcf107bcea2096bfb1a0a05 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Thu, 30 Mar 2006 21:47:21 +0000 Subject: [PATCH] - MFH Add tests --- ext/xmlreader/tests/011.phpt | 34 ++++++++++++++++++ ext/xmlreader/tests/012.dtd | 2 ++ ext/xmlreader/tests/012.phpt | 69 ++++++++++++++++++++++++++++++++++++ ext/xmlreader/tests/012.xml | 3 ++ 4 files changed, 108 insertions(+) create mode 100644 ext/xmlreader/tests/011.phpt create mode 100755 ext/xmlreader/tests/012.dtd create mode 100755 ext/xmlreader/tests/012.phpt create mode 100755 ext/xmlreader/tests/012.xml diff --git a/ext/xmlreader/tests/011.phpt b/ext/xmlreader/tests/011.phpt new file mode 100644 index 0000000000..89599232fc --- /dev/null +++ b/ext/xmlreader/tests/011.phpt @@ -0,0 +1,34 @@ +--TEST-- +XMLReader: libxml2 XML Reader, string data +--SKIPIF-- + +--FILE-- + +test'; + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->read(); +echo $reader->readInnerXml(); +echo "\n"; +$reader->close(); + + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->read(); +echo $reader->readOuterXml(); +echo "\n"; +$reader->close(); +?> +===DONE=== +--EXPECT-- +test +test +===DONE=== diff --git a/ext/xmlreader/tests/012.dtd b/ext/xmlreader/tests/012.dtd new file mode 100755 index 0000000000..b65412af0e --- /dev/null +++ b/ext/xmlreader/tests/012.dtd @@ -0,0 +1,2 @@ + + diff --git a/ext/xmlreader/tests/012.phpt b/ext/xmlreader/tests/012.phpt new file mode 100755 index 0000000000..e420bb7a17 --- /dev/null +++ b/ext/xmlreader/tests/012.phpt @@ -0,0 +1,69 @@ +--TEST-- +XMLReader: accessing empty and non existing attributes +--SKIPIF-- + +--FILE-- + + +EOF; + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->read(); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +$xmlstring =<< + + +EOF; + +$xmlstring = str_replace('012.dtd', dirname(__FILE__).'/012.dtd', $xmlstring); + +$reader = new XMLReader(); +$reader->XML($xmlstring); +$reader->setParserProperty(XMLReader::DEFAULTATTRS, true); +while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +?> +===FILE=== +open(dirname(__FILE__) . '/012.xml'); +//$reader->setParserProperty(XMLReader::DEFAULTATTRS, true); +while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +$reader = new XMLReader(); +$reader->open(dirname(__FILE__) . '/012.xml'); +$reader->setParserProperty(XMLReader::DEFAULTATTRS, true); +while($reader->read() && $reader->nodeType != XMLReader::ELEMENT); +var_dump($reader->getAttribute('bar')); +var_dump($reader->getAttribute('baz')); +$reader->close(); + +?> +===DONE=== +--EXPECT-- +string(0) "" +NULL +string(0) "" +string(0) "" +===FILE=== +string(0) "" +NULL +string(0) "" +string(0) "" +===DONE=== diff --git a/ext/xmlreader/tests/012.xml b/ext/xmlreader/tests/012.xml new file mode 100755 index 0000000000..5012bd5eff --- /dev/null +++ b/ext/xmlreader/tests/012.xml @@ -0,0 +1,3 @@ + + + -- 2.40.0