Browse files

cosmetic difference in expected error message in PHP4 vs PHP5.0/5.1 v…

…s 5.2+... as such, split bug-9328.phpt into three tests;

git-svn-id: https://svn.php.net/repository/pear/packages/XML_Parser/trunk@287133 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 82bc936 commit d20cad1b971842c1b4965d5861df3fb49fcc0a9c Chuck Burgess committed Aug 12, 2009
Showing with 85 additions and 1 deletion.
  1. +2 −0 package.xml
  2. +2 −0 package2.xml
  3. +7 −1 tests/bug-9328.phpt
  4. +38 −0 tests/bug-9328b.phpt
  5. +36 −0 tests/bug-9328c.phpt
View
2 package.xml
@@ -72,6 +72,8 @@ Furthermore its now possible to split the parser from the handler object, so you
<file role="test" name="005.phpt"/>
<file role="test" name="AllTests.php"/>
<file role="test" name="bug-9328.phpt"/>
+ <file role="test" name="bug-9328b.phpt"/>
+ <file role="test" name="bug-9328c.phpt"/>
<file role="test" name="test2.xml"/>
<file role="test" name="test3.xml"/>
</dir> <!-- /tests -->
View
2 package2.xml
@@ -77,6 +77,8 @@ Furthermore its now possible to split the parser from the handler object, so you
<file baseinstalldir="XML" name="005.phpt" role="test" />
<file baseinstalldir="XML" name="AllTests.php" role="test" />
<file baseinstalldir="XML" name="bug-9328.phpt" role="test" />
+ <file baseinstalldir="XML" name="bug-9328b.phpt" role="test" />
+ <file baseinstalldir="XML" name="bug-9328c.phpt" role="test" />
<file baseinstalldir="XML" name="test2.xml" role="test" />
<file baseinstalldir="XML" name="test3.xml" role="test" />
</dir> <!-- /tests -->
View
8 tests/bug-9328.phpt
@@ -2,6 +2,12 @@
XML Parser: test for Bug #9328 "assigned by reference error in XML_RSS parse"
--SKIPIF--
<?php
+if (version_compare(PHP_VERSION, '5.0.0', 'ge')) {
+ print 'skip - test only applies to PHP4';
+}
+if (!extension_loaded('xml')) {
+ print 'skip - xml extension not available';
+}
/*
* can't test if XML_RSS is not installed
*/
@@ -27,4 +33,4 @@ $error = $rss->parse();
echo $error->getMessage() . PHP_EOL;
?>
--EXPECT--
-XML_Parser: Invalid document end at XML input line 1:1
+XML_Parser: syntax error at XML input line 1:0
View
38 tests/bug-9328b.phpt
@@ -0,0 +1,38 @@
+--TEST--
+XML Parser: test for Bug #9328 "assigned by reference error in XML_RSS parse"
+--SKIPIF--
+<?php
+if (version_compare(PHP_VERSION, '5.0.0', 'lt')
+ || version_compare(PHP_VERSION, '5.2.0', 'ge')
+) {
+ print 'skip - test only applies to PHP5.0.x and PHP5.1.x';
+}
+if (!extension_loaded('xml')) {
+ print 'skip - xml extension not available';
+}
+/*
+ * can't test if XML_RSS is not installed
+ */
+$originalErrorReporting = error_reporting();
+error_reporting(E_ALL & ~E_WARNING);
+if (false == (include_once 'XML/RSS.php')) {
+ print('skip - XML_RSS is not installed');
+}
+error_reporting($originalErrorReporting);
+?>
+--FILE--
+<?php
+/*
+ * this issue only exists in PHP4
+ */
+
+require_once 'XML/RSS.php';
+
+$url = 'www.someverybogusurl.com';
+$rss =& new XML_RSS($url);
+
+$error = $rss->parse();
+echo $error->getMessage() . PHP_EOL;
+?>
+--EXPECT--
+XML_Parser: Empty document at XML input line 1:1
View
36 tests/bug-9328c.phpt
@@ -0,0 +1,36 @@
+--TEST--
+XML Parser: test for Bug #9328 "assigned by reference error in XML_RSS parse"
+--SKIPIF--
+<?php
+if (version_compare(PHP_VERSION, '5.2.0', 'lt')) {
+ print 'skip - test only applies to PHP5.2.x and higher';
+}
+if (!extension_loaded('xml')) {
+ print 'skip - xml extension not available';
+}
+/*
+ * can't test if XML_RSS is not installed
+ */
+$originalErrorReporting = error_reporting();
+error_reporting(E_ALL & ~E_WARNING);
+if (false == (include_once 'XML/RSS.php')) {
+ print('skip - XML_RSS is not installed');
+}
+error_reporting($originalErrorReporting);
+?>
+--FILE--
+<?php
+/*
+ * this issue only exists in PHP4
+ */
+
+require_once 'XML/RSS.php';
+
+$url = 'www.someverybogusurl.com';
+$rss =& new XML_RSS($url);
+
+$error = $rss->parse();
+echo $error->getMessage() . PHP_EOL;
+?>
+--EXPECT--
+XML_Parser: Not well-formed (invalid token) at XML input line 1:1

0 comments on commit d20cad1

Please sign in to comment.