summaryrefslogtreecommitdiff
path: root/tests/test_tools/simpletest/xml.php
diff options
context:
space:
mode:
authorxue <>2006-07-16 01:50:23 +0000
committerxue <>2006-07-16 01:50:23 +0000
commitaf68030fcf0c266300feb2c100149ecadef7d364 (patch)
tree76b7c8ad5d8227870b9ef10c3e7b92a36336b320 /tests/test_tools/simpletest/xml.php
parent4b78404c20490a615459267426ce9e6737bf4485 (diff)
Merge from 3.0 branch till 1264.
Diffstat (limited to 'tests/test_tools/simpletest/xml.php')
-rw-r--r--tests/test_tools/simpletest/xml.php107
1 files changed, 53 insertions, 54 deletions
diff --git a/tests/test_tools/simpletest/xml.php b/tests/test_tools/simpletest/xml.php
index dd007d41..0d578751 100644
--- a/tests/test_tools/simpletest/xml.php
+++ b/tests/test_tools/simpletest/xml.php
@@ -3,7 +3,7 @@
* base include file for SimpleTest
* @package SimpleTest
* @subpackage UnitTester
- * @version $Id: xml.php,v 1.20 2004/08/04 22:09:39 lastcraft Exp $
+ * @version $Id: xml.php,v 1.22 2006/02/06 06:05:18 lastcraft Exp $
*/
/**#@+
@@ -11,7 +11,7 @@
*/
require_once(dirname(__FILE__) . '/scorer.php');
/**#@-*/
-
+
/**
* Creates the XML needed for remote communication
* by SimpleTest.
@@ -21,7 +21,7 @@
class XmlReporter extends SimpleReporter {
protected $_indent;
protected $_namespace;
-
+
/**
* Does nothing yet.
* @access public
@@ -31,7 +31,7 @@
$this->_namespace = ($namespace ? $namespace . ':' : '');
$this->_indent = $indent;
}
-
+
/**
* Calculates the pretty printing indent level
* from the current level of nesting.
@@ -44,7 +44,7 @@
$this->_indent,
count($this->getTestList()) + $offset);
}
-
+
/**
* Converts character string to parsed XML
* entities string.
@@ -58,7 +58,7 @@
array('&amp;', '&lt;', '&gt;', '&quot;', '&apos;'),
$text);
}
-
+
/**
* Paints the start of a group test.
* @param string $test_name Name of test that is starting.
@@ -74,7 +74,7 @@
$this->toParsedXml($test_name) .
"</" . $this->_namespace . "name>\n";
}
-
+
/**
* Paints the end of a group test.
* @param string $test_name Name of test that is ending.
@@ -85,7 +85,7 @@
print "</" . $this->_namespace . "group>\n";
parent::paintGroupEnd($test_name);
}
-
+
/**
* Paints the start of a test case.
* @param string $test_name Name of test that is starting.
@@ -100,7 +100,7 @@
$this->toParsedXml($test_name) .
"</" . $this->_namespace . "name>\n";
}
-
+
/**
* Paints the end of a test case.
* @param string $test_name Name of test that is ending.
@@ -111,7 +111,7 @@
print "</" . $this->_namespace . "case>\n";
parent::paintCaseEnd($test_name);
}
-
+
/**
* Paints the start of a test method.
* @param string $test_name Name of test that is starting.
@@ -126,7 +126,7 @@
$this->toParsedXml($test_name) .
"</" . $this->_namespace . "name>\n";
}
-
+
/**
* Paints the end of a test method.
* @param string $test_name Name of test that is ending.
@@ -138,7 +138,7 @@
print "</" . $this->_namespace . "test>\n";
parent::paintMethodEnd($test_name);
}
-
+
/**
* Increments the pass count.
* @param string $message Message is ignored.
@@ -151,7 +151,7 @@
print $this->toParsedXml($message);
print "</" . $this->_namespace . "pass>\n";
}
-
+
/**
* Increments the fail count.
* @param string $message Message is ignored.
@@ -164,15 +164,15 @@
print $this->toParsedXml($message);
print "</" . $this->_namespace . "fail>\n";
}
-
+
/**
* Paints a PHP error or exception.
* @param string $message Message is ignored.
* @access public
* @abstract
*/
- function paintException($message) {
- parent::paintException($message);
+ function paintError($message) {
+ parent::paintError($message);
print $this->_getIndent(1);
print "<" . $this->_namespace . "exception>";
print $this->toParsedXml($message);
@@ -191,7 +191,7 @@
print $this->toParsedXml($message);
print "</" . $this->_namespace . "message>\n";
}
-
+
/**
* Paints a formatted ASCII message such as a
* variable dump.
@@ -239,7 +239,7 @@
print "?>\n";
print "<" . $this->_namespace . "run>\n";
}
-
+
/**
* Paints the test document footer.
* @param string $test_name The top level test.
@@ -250,7 +250,7 @@
print "</" . $this->_namespace . "run>\n";
}
}
-
+
/**
* Accumulator for incoming tag. Holds the
* incoming test structure information for
@@ -261,7 +261,7 @@
class NestingXmlTag {
protected $_name;
protected $_attributes;
-
+
/**
* Sets the basic test information except
* the name.
@@ -272,7 +272,7 @@
$this->_name = false;
$this->_attributes = $attributes;
}
-
+
/**
* Sets the test case/method name.
* @param string $name Name of test.
@@ -281,7 +281,7 @@
function setName($name) {
$this->_name = $name;
}
-
+
/**
* Accessor for name.
* @return string Name of test.
@@ -290,7 +290,7 @@
function getName() {
return $this->_name;
}
-
+
/**
* Accessor for attributes.
* @return hash All attributes.
@@ -300,7 +300,7 @@
return $this->_attributes;
}
}
-
+
/**
* Accumulator for incoming method tag. Holds the
* incoming test structure information for
@@ -309,7 +309,7 @@
* @subpackage UnitTester
*/
class NestingMethodTag extends NestingXmlTag {
-
+
/**
* Sets the basic test information except
* the name.
@@ -319,7 +319,7 @@
function NestingMethodTag($attributes) {
$this->NestingXmlTag($attributes);
}
-
+
/**
* Signals the appropriate start event on the
* listener.
@@ -328,8 +328,8 @@
*/
function paintStart($listener) {
$listener->paintMethodStart($this->getName());
- }
-
+ }
+
/**
* Signals the appropriate end event on the
* listener.
@@ -340,7 +340,7 @@
$listener->paintMethodEnd($this->getName());
}
}
-
+
/**
* Accumulator for incoming case tag. Holds the
* incoming test structure information for
@@ -349,7 +349,7 @@
* @subpackage UnitTester
*/
class NestingCaseTag extends NestingXmlTag {
-
+
/**
* Sets the basic test information except
* the name.
@@ -359,7 +359,7 @@
function NestingCaseTag($attributes) {
$this->NestingXmlTag($attributes);
}
-
+
/**
* Signals the appropriate start event on the
* listener.
@@ -368,8 +368,8 @@
*/
function paintStart($listener) {
$listener->paintCaseStart($this->getName());
- }
-
+ }
+
/**
* Signals the appropriate end event on the
* listener.
@@ -380,7 +380,7 @@
$listener->paintCaseEnd($this->getName());
}
}
-
+
/**
* Accumulator for incoming group tag. Holds the
* incoming test structure information for
@@ -389,7 +389,7 @@
* @subpackage UnitTester
*/
class NestingGroupTag extends NestingXmlTag {
-
+
/**
* Sets the basic test information except
* the name.
@@ -409,7 +409,7 @@
function paintStart($listener) {
$listener->paintGroupStart($this->getName(), $this->getSize());
}
-
+
/**
* Signals the appropriate end event on the
* listener.
@@ -419,7 +419,7 @@
function paintEnd($listener) {
$listener->paintGroupEnd($this->getName());
}
-
+
/**
* The size in the attributes.
* @return integer Value of size attribute or zero.
@@ -433,7 +433,7 @@
return 0;
}
}
-
+
/**
* Parser for importing the output of the XmlReporter.
* Dispatches that output to another reporter.
@@ -447,7 +447,7 @@
protected $_in_content_tag;
protected $_content;
protected $_attributes;
-
+
/**
* Loads a listener with the SimpleReporter
* interface.
@@ -462,7 +462,7 @@
$this->_content = '';
$this->_attributes = array();
}
-
+
/**
* Parses a block of XML sending the results to
* the listener.
@@ -478,13 +478,13 @@
}
return true;
}
-
+
/**
* Sets up expat as the XML parser.
* @return resource Expat handle.
* @access protected
*/
- function _createParser() {
+ function &_createParser() {
$expat = xml_parser_create();
xml_set_object($expat, $this);
xml_set_element_handler($expat, '_startElement', '_endElement');
@@ -492,7 +492,7 @@
xml_set_default_handler($expat, '_default');
return $expat;
}
-
+
/**
* Opens a new test nesting level.
* @return NestedXmlTag The group, case or method tag
@@ -502,17 +502,17 @@
function _pushNestingTag($nested) {
array_unshift($this->_tag_stack, $nested);
}
-
+
/**
* Accessor for current test structure tag.
* @return NestedXmlTag The group, case or method tag
* being parsed.
* @access private
*/
- function _getCurrentNestingTag() {
+ function &_getCurrentNestingTag() {
return $this->_tag_stack[0];
}
-
+
/**
* Ends a nesting tag.
* @return NestedXmlTag The group, case or method tag
@@ -522,7 +522,7 @@
function _popNestingTag() {
return array_shift($this->_tag_stack);
}
-
+
/**
* Test if tag is a leaf node with only text content.
* @param string $tag XML tag name.
@@ -530,9 +530,8 @@
* @private
*/
function _isLeaf($tag) {
- return in_array(
- $tag,
- array('NAME', 'PASS', 'FAIL', 'EXCEPTION', 'MESSAGE', 'FORMATTED', 'SIGNAL'));
+ return in_array($tag, array(
+ 'NAME', 'PASS', 'FAIL', 'EXCEPTION', 'MESSAGE', 'FORMATTED', 'SIGNAL'));
}
/**
@@ -557,7 +556,7 @@
$this->_content = '';
}
}
-
+
/**
* End of element event.
* @param resource $expat Parser handle.
@@ -578,7 +577,7 @@
} elseif ($tag == 'FAIL') {
$this->_listener->paintFail($this->_content);
} elseif ($tag == 'EXCEPTION') {
- $this->_listener->paintException($this->_content);
+ $this->_listener->paintError($this->_content);
} elseif ($tag == 'SIGNAL') {
$this->_listener->paintSignal(
$this->_attributes['TYPE'],
@@ -589,7 +588,7 @@
$this->_listener->paintFormattedMessage($this->_content);
}
}
-
+
/**
* Content between start and end elements.
* @param resource $expat Parser handle.
@@ -602,7 +601,7 @@
}
return true;
}
-
+
/**
* XML and Doctype handler. Discards all such content.
* @param resource $expat Parser handle.