Permalink
Browse files

cosmetic difference in expected error message in PHP4 vs PHP5... as s…

…uch, split 004.phpt into two tests;

git-svn-id: https://svn.php.net/repository/pear/packages/XML_Parser/trunk@287131 c90b9560-bf6c-de11-be94-00142212c4b1
  • Loading branch information...
1 parent 2d97add commit 7234539504dbadb9086fcc92d677d58b7e93070f Chuck Burgess committed Aug 12, 2009
Showing with 44 additions and 20 deletions.
  1. +1 −0 package.xml
  2. +1 −0 package2.xml
  3. +16 −20 tests/004.phpt
  4. +26 −0 tests/004b.phpt
View
@@ -68,6 +68,7 @@ Furthermore its now possible to split the parser from the handler object, so you
<file role="test" name="002.phpt"/>
<file role="test" name="003.phpt"/>
<file role="test" name="004.phpt"/>
+ <file role="test" name="004b.phpt"/>
<file role="test" name="005.phpt"/>
<file role="test" name="AllTests.php"/>
<file role="test" name="bug-9328.phpt"/>
View
@@ -73,6 +73,7 @@ Furthermore its now possible to split the parser from the handler object, so you
<file baseinstalldir="XML" name="002.phpt" role="test" />
<file baseinstalldir="XML" name="003.phpt" role="test" />
<file baseinstalldir="XML" name="004.phpt" role="test" />
+ <file baseinstalldir="XML" name="004b.phpt" role="test" />
<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" />
View
@@ -1,30 +1,26 @@
--TEST--
-XML Parser: error class
+XML Parser: error class (PHP4 behavior)
--SKIPIF--
-<?php if (!extension_loaded("xml")) echo 'skip'; ?>
---FILE--
-<?php // -*- C++ -*-
-//
-// Test for: XML/Parser.php
-// Parts tested: - parser error class
-//
-chdir (dirname(__FILE__));
-if (file_exists('../Parser.php')) {
- require_once "../Parser.php";
-} else {
- require_once "XML/Parser.php";
+<?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';
}
-
-print "new XML_Parser ";
+?>
+--FILE--
+<?php
+require_once 'XML/Parser.php';
+print 'New XML_Parser: ';
var_dump(strtolower(get_class($p = new XML_Parser())));
$e = $p->parseString("<?xml version='1.0' ?>\n<foo></bar>", true);
if (PEAR::isError($e)) {
- printf("error message: %s\n", $e->getMessage());
+ printf("Error message: %s" . PHP_EOL, $e->getMessage());
} else {
- print "no error\n";
+ print "No error" . PHP_EOL;
}
-
?>
--EXPECT--
-new XML_Parser string(10) "xml_parser"
-error message: XML_Parser: Mismatched tag at XML input line 2:12
+New XML_Parser: string(10) "xml_parser"
+Error message: XML_Parser: mismatched tag at XML input line 2:7
View
@@ -0,0 +1,26 @@
+--TEST--
+XML Parser: error class (PHP5 behavior)
+--SKIPIF--
+<?php
+if (version_compare(PHP_VERSION, '5.0.0', 'lt')) {
+ print 'skip - test only applies to PHP5';
+}
+if (!extension_loaded('xml')) {
+ print 'skip - xml extension not available';
+}
+?>
+--FILE--
+<?php
+require_once 'XML/Parser.php';
+print 'New XML_Parser: ';
+var_dump(strtolower(get_class($p = new XML_Parser())));
+$e = $p->parseString("<?xml version='1.0' ?>\n<foo></bar>", true);
+if (PEAR::isError($e)) {
+ printf("Error message: %s" . PHP_EOL, $e->getMessage());
+} else {
+ print "No error" . PHP_EOL;
+}
+?>
+--EXPECT--
+New XML_Parser: string(10) "xml_parser"
+Error message: XML_Parser: Mismatched tag at XML input line 2:12

0 comments on commit 7234539

Please sign in to comment.