summaryrefslogtreecommitdiff
path: root/buildscripts/PHPUnit2/Util
diff options
context:
space:
mode:
authorxue <>2006-06-19 18:38:29 +0000
committerxue <>2006-06-19 18:38:29 +0000
commit588727c7e2b8954ec3dbde293cf4c4d68b119f9b (patch)
treefdcc16181a20335547953ccf1550e0006c11bf28 /buildscripts/PHPUnit2/Util
parent127f78a4db3cc0fbbbb92f5b1abcfdce4a9af93b (diff)
Merge from 3.0 branch till 1185.
Diffstat (limited to 'buildscripts/PHPUnit2/Util')
-rw-r--r--buildscripts/PHPUnit2/Util/CodeCoverage/Renderer.php225
-rw-r--r--buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/HTML.php191
-rw-r--r--buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/Text.php125
-rw-r--r--buildscripts/PHPUnit2/Util/ErrorHandler.php77
-rw-r--r--buildscripts/PHPUnit2/Util/Fileloader.php109
-rw-r--r--buildscripts/PHPUnit2/Util/Filter.php263
-rw-r--r--buildscripts/PHPUnit2/Util/Log/PEAR.php220
-rw-r--r--buildscripts/PHPUnit2/Util/Log/XML.php356
-rw-r--r--buildscripts/PHPUnit2/Util/Printer.php116
-rw-r--r--buildscripts/PHPUnit2/Util/Skeleton.php340
-rw-r--r--buildscripts/PHPUnit2/Util/TestDox/NamePrettifier.php165
-rw-r--r--buildscripts/PHPUnit2/Util/TestDox/ResultPrinter.php299
-rw-r--r--buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/HTML.php120
-rw-r--r--buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/Text.php102
14 files changed, 2708 insertions, 0 deletions
diff --git a/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer.php b/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer.php
new file mode 100644
index 00000000..cbcdda51
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer.php
@@ -0,0 +1,225 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: Renderer.php,v 1.8.2.7 2006/02/25 17:02:23 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+/**
+ * Abstract base class for Code Coverage renderers.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ * @abstract
+ */
+abstract class PHPUnit2_Util_CodeCoverage_Renderer {
+ /**
+ * @var array
+ * @access protected
+ */
+ protected $codeCoverageInformation;
+
+ /**
+ * Constructor.
+ *
+ * @param array $codeCoverageInformation
+ * @access protected
+ */
+ protected function __construct($codeCoverageInformation) {
+ $this->codeCoverageInformation = $codeCoverageInformation;
+ }
+
+ /**
+ * Abstract Factory.
+ *
+ * @param string $rendererName
+ * @param array $codeCoverageInformation
+ * @throws Exception
+ * @access public
+ */
+ public function factory($rendererName, $codeCoverageInformation) {
+ require_once 'PHPUnit2/Util/CodeCoverage/Renderer/' . $rendererName . '.php';
+
+ $class = 'PHPUnit2_Util_CodeCoverage_Renderer_' . $rendererName;
+ return new $class($codeCoverageInformation);
+ }
+
+ /**
+ * Visualizes the result array of
+ * PHPUnit2_Framework_TestResult::getCodeCoverageInformation().
+ *
+ * @return string
+ * @access public
+ * @final
+ */
+ public final function render() {
+ $buffer = $this->header();
+
+ foreach ($this->getSummary() as $sourceFile => $executedLines) {
+ if (file_exists($sourceFile)) {
+ $buffer .= $this->startSourceFile($sourceFile);
+ $buffer .= $this->renderSourceFile(file($sourceFile), $executedLines);
+ $buffer .= $this->endSourceFile($sourceFile);
+ }
+ }
+
+ return $buffer . $this->footer();
+ }
+
+ /**
+ * Visualizes the result array of
+ * PHPUnit2_Framework_TestResult::getCodeCoverageInformation()
+ * and writes it to a file.
+ *
+ * @param string $filename
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function renderToFile($filename) {
+ if ($fp = fopen($filename, 'w')) {
+ fputs(
+ $fp,
+ $this->render()
+ );
+
+ fclose($fp);
+ }
+ }
+
+ /**
+ * Returns summarized Code Coverage data.
+ *
+ * Format of the result array:
+ *
+ * <code>
+ * array(
+ * "/tested/code.php" => array(
+ * linenumber => flag
+ * )
+ * )
+ * </code>
+ *
+ * flag > 0: line was executed.
+ * flag < 0: line is executable but was not executed.
+ *
+ * @return array
+ * @access protected
+ * @since Method available since Release 2.2.0
+ */
+ protected function getSummary() {
+ $summary = array();
+
+ foreach ($this->codeCoverageInformation as $testCaseName => $sourceFiles) {
+ foreach ($sourceFiles as $sourceFile => $executedLines) {
+ foreach ($executedLines as $lineNumber => $flag) {
+ if (!isset($summary[$sourceFile][$lineNumber])) {
+ $summary[$sourceFile][$lineNumber] = $flag;
+ }
+
+ else if ($flag > 0) {
+ $summary[$sourceFile][$lineNumber] = $flag;
+ }
+ }
+ }
+ }
+
+ return $summary;
+ }
+
+ /**
+ * @return string
+ * @access protected
+ * @since Method available since Release 2.1.1
+ */
+ protected function header() {
+ }
+
+ /**
+ * @return string
+ * @access protected
+ * @since Method available since Release 2.1.1
+ */
+ protected function footer() {
+ }
+
+ /**
+ * @param string $sourceFile
+ * @return string
+ * @access protected
+ */
+ protected function startSourceFile($sourceFile) {
+ }
+
+ /**
+ * @param string $sourceFile
+ * @return string
+ * @access protected
+ */
+ protected function endSourceFile($sourceFile) {
+ }
+
+ /**
+ * @param array $codeLines
+ * @param array $executedLines
+ * @return string
+ * @access protected
+ * @abstract
+ */
+ abstract protected function renderSourceFile($codeLines, $executedLines);
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/HTML.php b/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/HTML.php
new file mode 100644
index 00000000..66fc4d13
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/HTML.php
@@ -0,0 +1,191 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: HTML.php,v 1.7.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+require_once 'PHPUnit2/Util/CodeCoverage/Renderer.php';
+
+/**
+ * Renders Code Coverage information in HTML format.
+ *
+ * Formatting of the generated HTML can be achieved through
+ * CSS (codecoverage.css).
+ *
+ * Example
+ *
+ * <code>
+ * td.ccLineNumber, td.ccCoveredLine, td.ccUncoveredLine, td.ccNotExecutableLine {
+ * font-family: monospace;
+ * white-space: pre;
+ * }
+ *
+ * td.ccLineNumber, td.ccCoveredLine {
+ * background-color: #aaaaaa;
+ * }
+ *
+ * td.ccNotExecutableLine {
+ * color: #aaaaaa;
+ * }
+ * </code>
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_CodeCoverage_Renderer_HTML extends PHPUnit2_Util_CodeCoverage_Renderer {
+ const pageHeader =
+'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <link href="codecoverage.css" type="text/css" rel="stylesheet" />
+ </head>
+ <body>
+';
+
+ const pageFooter =
+' </body>
+</html>
+';
+
+ const sourceFileHeader =
+' <table style="border: 1px solid black" cellspacing="0" cellpadding="0" width="100%">
+';
+
+ const sourceFileFooter =
+' </table>
+';
+
+ const codeLine =
+' <tr><td class="ccLineNumber">%s</td><td class="%s">%s</td></tr>
+';
+
+ /**
+ * @return string
+ * @access protected
+ * @since Method available since Release 2.1.1
+ */
+ protected function header() {
+ return self::pageHeader;
+ }
+
+ /**
+ * @return string
+ * @access protected
+ * @since Method available since Release 2.1.1
+ */
+ protected function footer() {
+ return self::pageFooter;
+ }
+
+ /**
+ * @param string $sourceFile
+ * @return string
+ * @access protected
+ */
+ protected function startSourceFile($sourceFile) {
+ return self::sourceFileHeader;
+ }
+
+ /**
+ * @param string $sourceFile
+ * @return string
+ * @access protected
+ */
+ protected function endSourceFile($sourceFile) {
+ return self::sourceFileFooter;
+ }
+
+ /**
+ * @param array $codeLines
+ * @param array $executedLines
+ * @return string
+ * @access protected
+ */
+ protected function renderSourceFile($codeLines, $executedLines) {
+ $buffer = '';
+ $line = 1;
+
+ foreach ($codeLines as $codeLine) {
+ $lineStyle = 'ccNotExecutableLine';
+
+ if (isset($executedLines[$line])) {
+ if ($executedLines[$line] > 0) {
+ $lineStyle = 'ccCoveredLine';
+ } else {
+ $lineStyle = 'ccUncoveredLine';
+ }
+ }
+
+ $buffer .= sprintf(
+ self::codeLine,
+
+ $line,
+ $lineStyle,
+ htmlspecialchars(rtrim($codeLine))
+ );
+
+ $line++;
+ }
+
+ return $buffer;
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/Text.php b/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/Text.php
new file mode 100644
index 00000000..6b083692
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/Text.php
@@ -0,0 +1,125 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: Text.php,v 1.6.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+require_once 'PHPUnit2/Util/CodeCoverage/Renderer.php';
+
+/**
+ * Renders Code Coverage information in text format.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_CodeCoverage_Renderer_Text extends PHPUnit2_Util_CodeCoverage_Renderer {
+ /**
+ * @param string $sourceFile
+ * @return string
+ * @access protected
+ */
+ protected function startSourceFile($sourceFile) {
+ return ' ' . $sourceFile . "\n\n";
+ }
+
+ /**
+ * @param string $sourceFile
+ * @return string
+ * @access protected
+ */
+ protected function endSourceFile($sourceFile) {
+ return "\n";
+ }
+
+ /**
+ * @param array $codeLines
+ * @param array $executedLines
+ * @return string
+ * @access protected
+ */
+ protected function renderSourceFile($codeLines, $executedLines) {
+ $buffer = '';
+ $line = 1;
+
+ foreach ($codeLines as $codeLine) {
+ $flag = '-';
+
+ if (isset($executedLines[$line])) {
+ if ($executedLines[$line] > 0) {
+ $flag = '+';
+ } else {
+ $flag = '#';
+ }
+ }
+
+ $buffer .= sprintf(
+ ' %4u|%s| %s',
+
+ $line,
+ $flag,
+ $codeLine
+ );
+
+ $line++;
+ }
+
+ return $buffer;
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/ErrorHandler.php b/buildscripts/PHPUnit2/Util/ErrorHandler.php
new file mode 100644
index 00000000..ee724ffe
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/ErrorHandler.php
@@ -0,0 +1,77 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: ErrorHandler.php,v 1.1.2.2 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+/**
+ * @param integer $errno
+ * @param string $errstr
+ * @param string $errfile
+ * @param integer $errline
+ * @throws PHPUnit2_Framework_Error
+ * @since Function available since Release 2.3.0
+ */
+function PHPUnit2_Util_ErrorHandler($errno, $errstr, $errfile, $errline) {
+ $trace = debug_backtrace();
+ array_shift($trace);
+
+ throw new PHPUnit2_Framework_Error(
+ $errstr,
+ $errno,
+ $errfile,
+ $errline,
+ $trace
+ );
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/Fileloader.php b/buildscripts/PHPUnit2/Util/Fileloader.php
new file mode 100644
index 00000000..bdcd49ed
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/Fileloader.php
@@ -0,0 +1,109 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: Fileloader.php,v 1.1.2.6 2005/12/19 05:43:56 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+/**
+ *
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.3.0
+ */
+class PHPUnit2_Util_Fileloader {
+ /**
+ * Checks if a PHP sourcefile is readable and contains no syntax errors.
+ * If that is the case, the sourcefile is loaded through include_once().
+ *
+ * @param string $filename
+ * @throws Exception
+ * @access public
+ * @static
+ */
+ public static function checkAndLoad($filename) {
+ if (!is_readable($filename)) {
+ $filename = './' . $filename;
+ }
+
+ if (!is_readable($filename)) {
+ throw new Exception(
+ sprintf(
+ '%s could not be found or is not readable.',
+
+ str_replace('./', '', $filename)
+ )
+ );
+ }
+
+ $output = shell_exec('php -l ' . escapeshellarg($filename));
+
+ if (strpos($output, 'No syntax errors detected in') === FALSE) {
+ throw new Exception(
+ sprintf(
+ 'Syntax error in %s.',
+
+ str_replace('./', '', $filename)
+ )
+ );
+ }
+
+ include_once $filename;
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/Filter.php b/buildscripts/PHPUnit2/Util/Filter.php
new file mode 100644
index 00000000..70d055fd
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/Filter.php
@@ -0,0 +1,263 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: Filter.php,v 1.32.2.5 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.0.0
+ */
+
+/**
+ * Utility class for code filtering.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.0.0
+ */
+class PHPUnit2_Util_Filter {
+ /**
+ * Source files that are to be filtered.
+ *
+ * @var array
+ * @access protected
+ * @static
+ */
+ protected static $filteredFiles = array(
+ 'PHPUnit2/Extensions/ExceptionTestCase.php',
+ 'PHPUnit2/Extensions/PerformanceTestCase.php',
+ 'PHPUnit2/Extensions/RepeatedTest.php',
+ 'PHPUnit2/Extensions/TestDecorator.php',
+ 'PHPUnit2/Extensions/TestSetup.php',
+ 'PHPUnit2/Framework/Assert.php',
+ 'PHPUnit2/Framework/AssertionFailedError.php',
+ 'PHPUnit2/Framework/ComparisonFailure.php',
+ 'PHPUnit2/Framework/Error.php',
+ 'PHPUnit2/Framework/IncompleteTest.php',
+ 'PHPUnit2/Framework/IncompleteTestError.php',
+ 'PHPUnit2/Framework/Test.php',
+ 'PHPUnit2/Framework/TestCase.php',
+ 'PHPUnit2/Framework/TestFailure.php',
+ 'PHPUnit2/Framework/TestListener.php',
+ 'PHPUnit2/Framework/TestResult.php',
+ 'PHPUnit2/Framework/TestSuite.php',
+ 'PHPUnit2/Framework/Warning.php',
+ 'PHPUnit2/Runner/BaseTestRunner.php',
+ 'PHPUnit2/Runner/IncludePathTestCollector.php',
+ 'PHPUnit2/Runner/StandardTestSuiteLoader.php',
+ 'PHPUnit2/Runner/TestCollector.php',
+ 'PHPUnit2/Runner/TestSuiteLoader.php',
+ 'PHPUnit2/Runner/Version.php',
+ 'PHPUnit2/TextUI/ResultPrinter.php',
+ 'PHPUnit2/TextUI/TestRunner.php',
+ 'PHPUnit2/Util/CodeCoverage/Renderer/HTML.php',
+ 'PHPUnit2/Util/CodeCoverage/Renderer/Text.php',
+ 'PHPUnit2/Util/CodeCoverage/Renderer.php',
+ 'PHPUnit2/Util/Log/PEAR.php',
+ 'PHPUnit2/Util/Log/XML.php',
+ 'PHPUnit2/Util/TestDox/ResultPrinter/HTML.php',
+ 'PHPUnit2/Util/TestDox/ResultPrinter/Text.php',
+ 'PHPUnit2/Util/TestDox/NamePrettifier.php',
+ 'PHPUnit2/Util/TestDox/ResultPrinter.php',
+ 'PHPUnit2/Util/ErrorHandler.php',
+ 'PHPUnit2/Util/Fileloader.php',
+ 'PHPUnit2/Util/Filter.php',
+ 'PHPUnit2/Util/Printer.php',
+ 'PHPUnit2/Util/Skeleton.php',
+ 'Benchmark/Timer.php',
+ 'Console/Getopt.php',
+ 'Log/composite.php',
+ 'Log/console.php',
+ 'Log/display.php',
+ 'Log/error.php',
+ 'Log/file.php',
+ 'Log/mail.php',
+ 'Log/mcal.php',
+ 'Log/null.php',
+ 'Log/observer.php',
+ 'Log/sql.php',
+ 'Log/sqlite.php',
+ 'Log/syslog.php',
+ 'Log/win.php',
+ 'Log.php',
+ 'PEAR/Config.php',
+ 'PEAR.php'
+ );
+
+ /**
+ * Adds a new file to be filtered.
+ *
+ * @param string
+ * @access public
+ * @static
+ * @since Method available since Release 2.1.0
+ */
+ public static function addFileToFilter($filename) {
+ $filename = self::getCanonicalFilename($filename);
+
+ if (!self::isFiltered($filename)) {
+ self::$filteredFiles[] = $filename;
+ }
+ }
+
+ /**
+ * Removes a file from the filter.
+ *
+ * @param string
+ * @access public
+ * @static
+ * @since Method available since Release 2.1.0
+ */
+ public static function removeFileFromFilter($filename) {
+ $filename = self::getCanonicalFilename($filename);
+ $keys = array_keys(self::$filteredFiles);
+
+ for ($i = 0; $i < sizeof($keys); $i++) {
+ if (self::$filteredFiles[$keys[$i]] == $filename) {
+ unset(self::$filteredFiles[$keys[$i]]);
+ break;
+ }
+ }
+ }
+
+ /**
+ * Filters source lines from PHPUnit classes.
+ *
+ * @param array
+ * @return array
+ * @access public
+ * @static
+ */
+ public static function getFilteredCodeCoverage($codeCoverageInformation) {
+ $files = array_keys($codeCoverageInformation);
+
+ foreach ($files as $file) {
+ if (self::isFiltered($file)) {
+ unset($codeCoverageInformation[$file]);
+ }
+ }
+
+ return $codeCoverageInformation;
+ }
+
+ /**
+ * Filters stack frames from PHPUnit classes.
+ *
+ * @param Exception $e
+ * @return string
+ * @access public
+ * @static
+ */
+ public static function getFilteredStacktrace(Exception $e) {
+ $filteredStacktrace = '';
+ $stacktrace = $e->getTrace();
+
+ foreach ($stacktrace as $frame) {
+ $filtered = FALSE;
+
+ if (isset($frame['file']) && !self::isFiltered($frame['file'])) {
+ $filteredStacktrace .= sprintf(
+ "%s:%s\n",
+
+ $frame['file'],
+ isset($frame['line']) ? $frame['line'] : '?'
+ );
+ }
+ }
+
+ return $filteredStacktrace;
+ }
+
+ /**
+ * Canonicalizes a source file name.
+ *
+ * @param string $filename
+ * @return string
+ * @access protected
+ * @static
+ */
+ protected static function getCanonicalFilename($filename) {
+ foreach (array('PHPUnit2', 'Benchmark', 'Console', 'PEAR') as $package) {
+ $pos = strpos($filename, $package);
+
+ if ($pos !== FALSE) {
+ $filename = substr($filename, $pos);
+ break;
+ }
+ }
+
+ return str_replace(
+ '\\',
+ '/',
+ $filename
+ );
+ }
+
+ /**
+ * @param string $filename
+ * @return boolean
+ * @access protected
+ * @static
+ * @since Method available since Release 2.1.3
+ */
+ protected static function isFiltered($filename) {
+ if (substr($filename, -7) == 'phpunit' ||
+ in_array(self::getCanonicalFilename($filename), self::$filteredFiles)) {
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/Log/PEAR.php b/buildscripts/PHPUnit2/Util/Log/PEAR.php
new file mode 100644
index 00000000..368c4f54
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/Log/PEAR.php
@@ -0,0 +1,220 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: PEAR.php,v 1.2.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+require_once 'PHPUnit2/Framework/TestListener.php';
+
+@include_once 'Log.php';
+
+/**
+ * A TestListener that logs to a PEAR_Log sink.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_Log_PEAR implements PHPUnit2_Framework_TestListener {
+ /**
+ * Log.
+ *
+ * @var Log
+ * @access private
+ */
+ private $log;
+
+ /**
+ * @param string $type The type of concrete Log subclass to use.
+ * Currently, valid values are 'console',
+ * 'syslog', 'sql', 'file', and 'mcal'.
+ * @param string $name The name of the actually log file, table, or
+ * other specific store to use. Defaults to an
+ * empty string, with which the subclass will
+ * attempt to do something intelligent.
+ * @param string $ident The identity reported to the log system.
+ * @param array $conf A hash containing any additional configuration
+ * information that a subclass might need.
+ * @param int $maxLevel Maximum priority level at which to log.
+ * @access public
+ */
+ public function __construct($type, $name = '', $ident = '', $conf = array(), $maxLevel = PEAR_LOG_DEBUG) {
+ $this->log = Log::factory($type, $name, $ident, $conf, $maxLevel);
+ }
+
+ /**
+ * An error occurred.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param Exception $e
+ * @access public
+ */
+ public function addError(PHPUnit2_Framework_Test $test, Exception $e) {
+ $this->log->crit(
+ sprintf(
+ 'Test "%s" failed: %s',
+
+ $test->getName(),
+ $e->getMessage()
+ )
+ );
+ }
+
+ /**
+ * A failure occurred.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param PHPUnit2_Framework_AssertionFailedError $e
+ * @access public
+ */
+ public function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e) {
+ $this->log->err(
+ sprintf(
+ 'Test "%s" failed: %s',
+
+ $test->getName(),
+ $e->getMessage()
+ )
+ );
+ }
+
+ /**
+ * Incomplete test.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param Exception $e
+ * @access public
+ */
+ public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e) {
+ $this->log->info(
+ sprintf(
+ 'Test "%s" incomplete: %s',
+
+ $test->getName(),
+ $e->getMessage()
+ )
+ );
+ }
+
+ /**
+ * A test suite started.
+ *
+ * @param PHPUnit2_Framework_TestSuite $suite
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function startTestSuite(PHPUnit2_Framework_TestSuite $suite) {
+ $this->log->info(
+ sprintf(
+ 'TestSuite "%s" started.',
+
+ $suite->getName()
+ )
+ );
+ }
+
+ /**
+ * A test suite ended.
+ *
+ * @param PHPUnit2_Framework_TestSuite $suite
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function endTestSuite(PHPUnit2_Framework_TestSuite $suite) {
+ $this->log->info(
+ sprintf(
+ 'TestSuite "%s" ended.',
+
+ $suite->getName()
+ )
+ );
+ }
+
+ /**
+ * A test started.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @access public
+ */
+ public function startTest(PHPUnit2_Framework_Test $test) {
+ $this->log->info(
+ sprintf(
+ 'Test "%s" started.',
+
+ $test->getName()
+ )
+ );
+ }
+
+ /**
+ * A test ended.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @access public
+ */
+ public function endTest(PHPUnit2_Framework_Test $test) {
+ $this->log->info(
+ sprintf(
+ 'Test "%s" ended.',
+
+ $test->getName()
+ )
+ );
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/Log/XML.php b/buildscripts/PHPUnit2/Util/Log/XML.php
new file mode 100644
index 00000000..ce528753
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/Log/XML.php
@@ -0,0 +1,356 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: XML.php,v 1.2.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+require_once 'PHPUnit2/Framework/TestListener.php';
+require_once 'PHPUnit2/Util/Filter.php';
+require_once 'PHPUnit2/Util/Printer.php';
+
+require_once 'Benchmark/Timer.php';
+
+/**
+ * A TestListener that generates an XML-based logfile
+ * of the test execution.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_Log_XML extends PHPUnit2_Util_Printer implements PHPUnit2_Framework_TestListener {
+ /**
+ * @var DOMDocument
+ * @access private
+ */
+ private $document;
+
+ /**
+ * @var DOMElement
+ * @access private
+ */
+ private $root;
+
+ /**
+ * @var boolean
+ * @access private
+ */
+ private $writeDocument = TRUE;
+
+ /**
+ * @var DOMElement[]
+ * @access private
+ */
+ private $testSuites = array();
+
+ /**
+ * @var integer[]
+ * @access private
+ */
+ private $testSuiteTests = array(0);
+
+ /**
+ * @var integer[]
+ * @access private
+ */
+ private $testSuiteErrors = array(0);
+
+ /**
+ * @var integer[]
+ * @access private
+ */
+ private $testSuiteFailures = array(0);
+
+ /**
+ * @var integer[]
+ * @access private
+ */
+ private $testSuiteTimes = array(0);
+
+ /**
+ * @var integer
+ * @access private
+ */
+ private $testSuiteLevel = 0;
+
+ /**
+ * @var DOMElement
+ * @access private
+ */
+ private $currentTestCase = NULL;
+
+ /**
+ * @var Benchmark_Timer
+ * @access private
+ */
+ private $timer;
+
+ /**
+ * Constructor.
+ *
+ * @param mixed $out
+ * @access public
+ */
+ public function __construct($out = NULL) {
+ $this->document = new DOMDocument('1.0', 'UTF-8');
+ $this->document->formatOutput = TRUE;
+
+ $this->root = $this->document->createElement('testsuites');
+ $this->document->appendChild($this->root);
+
+ $this->timer = new Benchmark_Timer;
+
+ parent::__construct($out);
+ }
+
+ /**
+ * Destructor.
+ *
+ * @access public
+ */
+ public function __destruct() {
+ if ($this->writeDocument === TRUE) {
+ $this->write($this->getXML());
+ }
+
+ parent::__destruct();
+ }
+
+ /**
+ * An error occurred.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param Exception $e
+ * @access public
+ */
+ public function addError(PHPUnit2_Framework_Test $test, Exception $e) {
+ $error = $this->document->createElement('error', PHPUnit2_Util_Filter::getFilteredStacktrace($e));
+ $error->setAttribute('message', $e->getMessage());
+ $error->setAttribute('type', get_class($e));
+
+ $this->currentTestCase->appendChild($error);
+
+ $this->testSuiteErrors[$this->testSuiteLevel]++;
+ }
+
+ /**
+ * A failure occurred.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param PHPUnit2_Framework_AssertionFailedError $e
+ * @access public
+ */
+ public function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e) {
+ $failure = $this->document->createElement('failure', PHPUnit2_Util_Filter::getFilteredStacktrace($e));
+ $failure->setAttribute('message', $e->getMessage());
+ $failure->setAttribute('type', get_class($e));
+
+ $this->currentTestCase->appendChild($failure);
+
+ $this->testSuiteFailures[$this->testSuiteLevel]++;
+ }
+
+ /**
+ * Incomplete test.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param Exception $e
+ * @access public
+ */
+ public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e) {
+ $error = $this->document->createElement('error', PHPUnit2_Util_Filter::getFilteredStacktrace($e));
+ $error->setAttribute('message', 'Incomplete Test');
+ $error->setAttribute('type', get_class($e));
+
+ $this->currentTestCase->appendChild($error);
+
+ $this->testSuiteErrors[$this->testSuiteLevel]++;
+ }
+
+ /**
+ * A testsuite started.
+ *
+ * @param PHPUnit2_Framework_TestSuite $suite
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function startTestSuite(PHPUnit2_Framework_TestSuite $suite) {
+ $testSuite = $this->document->createElement('testsuite');
+ $testSuite->setAttribute('name', $suite->getName());
+
+ try {
+ $class = new ReflectionClass($suite->getName());
+ $docComment = $class->getDocComment();
+
+ if (preg_match('/@category[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $testSuite->setAttribute('category', $matches[1]);
+ }
+
+ if (preg_match('/@package[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $testSuite->setAttribute('package', $matches[1]);
+ }
+
+ if (preg_match('/@subpackage[\s]+([\.\w]+)/', $docComment, $matches)) {
+ $testSuite->setAttribute('subpackage', $matches[1]);
+ }
+ }
+
+ catch (ReflectionException $e) {
+ }
+
+ if ($this->testSuiteLevel > 0) {
+ $this->testSuites[$this->testSuiteLevel]->appendChild($testSuite);
+ } else {
+ $this->root->appendChild($testSuite);
+ }
+
+ $this->testSuiteLevel++;
+ $this->testSuites[$this->testSuiteLevel] = $testSuite;
+ $this->testSuiteTests[$this->testSuiteLevel] = 0;
+ $this->testSuiteErrors[$this->testSuiteLevel] = 0;
+ $this->testSuiteFailures[$this->testSuiteLevel] = 0;
+ $this->testSuiteTimes[$this->testSuiteLevel] = 0;
+ }
+
+ /**
+ * A testsuite ended.
+ *
+ * @param PHPUnit2_Framework_TestSuite $suite
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function endTestSuite(PHPUnit2_Framework_TestSuite $suite) {
+ $this->testSuites[$this->testSuiteLevel]->setAttribute('tests', $this->testSuiteTests[$this->testSuiteLevel]);
+ $this->testSuites[$this->testSuiteLevel]->setAttribute('failures', $this->testSuiteFailures[$this->testSuiteLevel]);
+ $this->testSuites[$this->testSuiteLevel]->setAttribute('errors', $this->testSuiteErrors[$this->testSuiteLevel]);
+ $this->testSuites[$this->testSuiteLevel]->setAttribute('time', $this->testSuiteTimes[$this->testSuiteLevel]);
+
+ if ($this->testSuiteLevel > 1) {
+ $this->testSuiteTests[$this->testSuiteLevel - 1] += $this->testSuiteTests[$this->testSuiteLevel];
+ $this->testSuiteErrors[$this->testSuiteLevel - 1] += $this->testSuiteErrors[$this->testSuiteLevel];
+ $this->testSuiteFailures[$this->testSuiteLevel - 1] += $this->testSuiteFailures[$this->testSuiteLevel];
+ $this->testSuiteTimes[$this->testSuiteLevel - 1] += $this->testSuiteTimes[$this->testSuiteLevel];
+ }
+
+ $this->testSuiteLevel--;
+ }
+
+ /**
+ * A test started.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @access public
+ */
+ public function startTest(PHPUnit2_Framework_Test $test) {
+ $testCase = $this->document->createElement('testcase');
+ $testCase->setAttribute('name', $test->getName());
+ $testCase->setAttribute('class', get_class($test));
+
+ $this->testSuites[$this->testSuiteLevel]->appendChild($testCase);
+ $this->currentTestCase = $testCase;
+
+ $this->testSuiteTests[$this->testSuiteLevel]++;
+
+ $this->timer->start();
+ }
+
+ /**
+ * A test ended.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @access public
+ */
+ public function endTest(PHPUnit2_Framework_Test $test) {
+ $this->timer->stop();
+ $time = $this->timer->timeElapsed();
+
+ $this->currentTestCase->setAttribute('time', $time);
+ $this->testSuiteTimes[$this->testSuiteLevel] += $time;
+
+ $this->currentTestCase = NULL;
+ }
+
+ /**
+ * Returns the XML as a string.
+ *
+ * @return string
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function getXML() {
+ return $this->document->saveXML();
+ }
+
+ /**
+ * Enables or disables the writing of the document
+ * in __destruct().
+ *
+ * This is a "hack" needed for the integration of
+ * PHPUnit with Phing.
+ *
+ * @return string
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function setWriteDocument($flag) {
+ if (is_bool($flag)) {
+ $this->writeDocument = $flag;
+ }
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/Printer.php b/buildscripts/PHPUnit2/Util/Printer.php
new file mode 100644
index 00000000..13dc46a9
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/Printer.php
@@ -0,0 +1,116 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: Printer.php,v 1.10.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.0.0
+ */
+
+/**
+ * Utility class that can print to STDOUT or write to a file.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.0.0
+ * @abstract
+ */
+abstract class PHPUnit2_Util_Printer {
+ /**
+ * @var resource
+ * @access private
+ */
+ private $out = NULL;
+
+ /**
+ * Constructor.
+ *
+ * @param mixed $out
+ * @access public
+ */
+ public function __construct($out = NULL) {
+ if ($out !== NULL) {
+ if (is_string($out)) {
+ $this->out = fopen($out, 'w');
+ } else {
+ $this->out = $out;
+ }
+ }
+ }
+
+ /**
+ * Destructor.
+ *
+ * @access public
+ */
+ public function __destruct() {
+ if ($this->out !== NULL) {
+ fclose($this->out);
+ }
+ }
+
+ /**
+ * @param string $buffer
+ * @access public
+ */
+ public function write($buffer) {
+ if ($this->out !== NULL) {
+ fputs($this->out, $buffer);
+ } else {
+ print $buffer;
+ }
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/Skeleton.php b/buildscripts/PHPUnit2/Util/Skeleton.php
new file mode 100644
index 00000000..39717557
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/Skeleton.php
@@ -0,0 +1,340 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: Skeleton.php,v 1.24.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.1.0
+ */
+
+/**
+ * Class for creating a PHPUnit2_Framework_TestCase skeleton file.
+ *
+ * This class will take a classname as a parameter on construction and will
+ * create a PHP file that contains the skeleton of a PHPUnit2_Framework_TestCase
+ * subclass.
+ *
+ * <code>
+ * <?php
+ * require_once 'PHPUnit2/Util/Skeleton.php';
+ *
+ * $skeleton = new PHPUnit2_Util_Skeleton(
+ * 'PHPUnit2_Util_Skeleton',
+ * 'PHPUnit2/Util/Skeleton.php'
+ * );
+ *
+ * $skeleton->write();
+ * ?>
+ * </code>
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_Skeleton {
+ protected $templateClassHeader =
+'<?php
+// Call {className}Test::main() if this source file is executed directly.
+if (!defined("PHPUnit2_MAIN_METHOD")) {
+ define("PHPUnit2_MAIN_METHOD", "{className}Test::main");
+}
+
+require_once "PHPUnit2/Framework/TestCase.php";
+require_once "PHPUnit2/Framework/TestSuite.php";
+
+// You may remove the following line when all tests have been implemented.
+require_once "PHPUnit2/Framework/IncompleteTestError.php";
+
+require_once "{classFile}";
+
+/**
+ * Test class for {className}.
+ * Generated by PHPUnit2_Util_Skeleton on {date} at {time}.
+ */
+class {className}Test extends PHPUnit2_Framework_TestCase {
+ /**
+ * Runs the test methods of this class.
+ *
+ * @access public
+ * @static
+ */
+ public static function main() {
+ require_once "PHPUnit2/TextUI/TestRunner.php";
+
+ $suite = new PHPUnit2_Framework_TestSuite("{className}Test");
+ $result = PHPUnit2_TextUI_TestRunner::run($suite);
+ }
+
+ /**
+ * Sets up the fixture, for example, open a network connection.
+ * This method is called before a test is executed.
+ *
+ * @access protected
+ */
+ protected function setUp() {
+ }
+
+ /**
+ * Tears down the fixture, for example, close a network connection.
+ * This method is called after a test is executed.
+ *
+ * @access protected
+ */
+ protected function tearDown() {
+ }
+';
+
+ protected $templateClassFooter =
+'}
+
+// Call {className}Test::main() if this source file is executed directly.
+if (PHPUnit2_MAIN_METHOD == "{className}Test::main") {
+ {className}Test::main();
+}
+?>
+';
+
+ protected $templateMethod =
+'
+ /**
+ * @todo Implement test{methodName}().
+ */
+ public function test{methodName}() {
+ // Remove the following line when you implement this test.
+ throw new PHPUnit2_Framework_IncompleteTestError;
+ }
+';
+
+ /**
+ * @var string
+ * @access protected
+ */
+ protected $className;
+
+ /**
+ * @var string
+ * @access protected
+ */
+ protected $classSourceFile;
+
+ /**
+ * Constructor.
+ *
+ * @param string $className
+ * @param string $classSourceFile
+ * @throws Exception
+ * @access public
+ */
+ public function __construct($className, $classSourceFile = '') {
+ if ($classSourceFile == '') {
+ $classSourceFile = $className . '.php';
+ }
+
+ if (file_exists($classSourceFile)) {
+ $this->classSourceFile = $classSourceFile;
+ } else {
+ throw new Exception(
+ sprintf(
+ 'Could not open %s.',
+
+ $classSourceFile
+ )
+ );
+ }
+
+ @include_once $this->classSourceFile;
+
+ if (class_exists($className)) {
+ $this->className = $className;
+ } else {
+ throw new Exception(
+ sprintf(
+ 'Could not find class "%s" in %s.',
+
+ $className,
+ $classSourceFile
+ )
+ );
+ }
+ }
+
+ /**
+ * Generates the test class' source.
+ *
+ * @return string
+ * @access public
+ */
+ public function generate() {
+ $testClassSource = $this->testClassHeader($this->className, $this->classSourceFile);
+
+ $class = new ReflectionClass($this->className);
+
+ foreach ($class->getMethods() as $method) {
+ if (!$method->isConstructor() &&
+ !$method->isAbstract() &&
+ $method->isUserDefined() &&
+ $method->isPublic() &&
+ $method->getDeclaringClass()->getName() == $this->className) {
+ $testClassSource .= $this->testMethod($method->getName());
+ }
+ }
+
+ $testClassSource .= $this->testClassFooter($this->className);
+
+ return $testClassSource;
+ }
+
+ /**
+ * Generates the test class and writes it to a source file.
+ *
+ * @param string $file
+ * @access public
+ */
+ public function write($file = '') {
+ if ($file == '') {
+ $file = $this->className . 'Test.php';
+ }
+
+ if ($fp = @fopen($file, 'w')) {
+ @fputs($fp, $this->generate());
+ @fclose($fp);
+ }
+ }
+
+ /**
+ * Sets the templates for class header, class footer, and method.
+ *
+ * @param string $classHeader
+ * @param string $classFooter
+ * @param string $method
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function setTemplates($classHeader, $classFooter, $method) {
+ if (is_file($classHeader)) {
+ $this->templateClassHeader = file_get_contents($classHeader);
+ } else {
+ $this->templateClassHeader = $classHeader;
+ }
+
+ if (is_file($classFooter)) {
+ $this->templateClassFooter = file_get_contents($classFooter);
+ } else {
+ $this->templateClassFooter = $classFooter;
+ }
+
+ if (is_file($method)) {
+ $this->templateMethod = file_get_contents($method);
+ } else {
+ $this->templateMethod = $method;
+ }
+ }
+
+ /**
+ * @param string $className
+ * @param string $classSourceFile
+ * @access protected
+ */
+ protected function testClassHeader($className, $classSourceFile) {
+ return str_replace(
+ array(
+ '{className}',
+ '{classFile}',
+ '{date}',
+ '{time}'
+ ),
+ array(
+ $className,
+ $classSourceFile,
+ date('Y-m-d'),
+ date('H:i:s')
+ ),
+ $this->templateClassHeader
+ );
+ }
+
+ /**
+ * @param string $className
+ * @access protected
+ */
+ protected function testClassFooter($className) {
+ return str_replace(
+ array(
+ '{className}'
+ ),
+ array(
+ $className
+ ),
+ $this->templateClassFooter
+ );
+ }
+
+ /**
+ * @param string $methodName
+ * @access protected
+ */
+ protected function testMethod($methodName) {
+ return str_replace(
+ array(
+ '{methodName}'
+ ),
+ array(
+ ucfirst($methodName)
+ ),
+ $this->templateMethod
+ );
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/TestDox/NamePrettifier.php b/buildscripts/PHPUnit2/Util/TestDox/NamePrettifier.php
new file mode 100644
index 00000000..1d686dc8
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/TestDox/NamePrettifier.php
@@ -0,0 +1,165 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: NamePrettifier.php,v 1.2.2.2 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+/**
+ * Prettifies class and method names for use in TestDox documentation.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_TestDox_NamePrettifier {
+ /**
+ * @var string
+ * @access protected
+ */
+ protected $prefix = 'Test';
+
+ /**
+ * @var string
+ * @access protected
+ */
+ protected $suffix = 'Test';
+
+ /**
+ * Tests if a method is a test method.
+ *
+ * @param string $testMethodName
+ * @return boolean
+ * @access public
+ */
+ public function isATestMethod($testMethodName) {
+ if (substr($testMethodName, 0, 4) == 'test') {
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ /**
+ * Prettifies the name of a test class.
+ *
+ * @param string $testClassName
+ * @return string
+ * @access public
+ */
+ public function prettifyTestClass($testClassName) {
+ $title = $testClassName;
+
+ if ($this->suffix !== NULL &&
+ $this->suffix == substr($testClassName, -1 * strlen($this->suffix))) {
+ $title = substr($title, 0, strripos($title, $this->suffix));
+ }
+
+ if ($this->prefix !== NULL &&
+ $this->prefix == substr($testClassName, 0, strlen($this->prefix))) {
+ $title = substr($title, strlen($this->prefix));
+ }
+
+ return $title;
+ }
+
+ /**
+ * Prettifies the name of a test method.
+ *
+ * @param string $testMethodName
+ * @return string
+ * @access public
+ */
+ public function prettifyTestMethod($testMethodName) {
+ $buffer = '';
+
+ $testMethodName = preg_replace('#\d+$#', '', $testMethodName);
+
+ for ($i = 4; $i < strlen($testMethodName); $i++) {
+ if ($i > 4 &&
+ ord($testMethodName[$i]) >= 65 &&
+ ord($testMethodName[$i]) <= 90) {
+ $buffer .= ' ' . strtolower($testMethodName[$i]);
+ } else {
+ $buffer .= $testMethodName[$i];
+ }
+ }
+
+ return $buffer;
+ }
+
+ /**
+ * Sets the prefix of test names.
+ *
+ * @param string $prefix
+ * @access public
+ */
+ public function setPrefix($prefix) {
+ $this->prefix = $prefix;
+ }
+
+ /**
+ * Sets the suffix of test names.
+ *
+ * @param string $prefix
+ * @access public
+ */
+ public function setSuffix($suffix) {
+ $this->suffix = $suffix;
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter.php b/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter.php
new file mode 100644
index 00000000..274c7309
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter.php
@@ -0,0 +1,299 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: ResultPrinter.php,v 1.2.2.6 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+require_once 'PHPUnit2/Framework/TestListener.php';
+require_once 'PHPUnit2/Util/TestDox/NamePrettifier.php';
+require_once 'PHPUnit2/Util/Printer.php';
+
+/**
+ * Base class for printers of TestDox documentation.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ * @abstract
+ */
+abstract class PHPUnit2_Util_TestDox_ResultPrinter extends PHPUnit2_Util_Printer implements PHPUnit2_Framework_TestListener {
+ /**
+ * @var PHPUnit2_Util_TestDox_NamePrettifier
+ * @access protected
+ */
+ protected $prettifier;
+
+ /**
+ * @var string
+ * @access protected
+ */
+ protected $testClass = '';
+
+ /**
+ * @var boolean
+ * @access protected
+ */
+ protected $testFailed = FALSE;
+
+ /**
+ * @var array
+ * @access protected
+ */
+ protected $tests = array();
+
+ /**
+ * Constructor.
+ *
+ * @param resource $out
+ * @access public
+ */
+ public function __construct($out = NULL) {
+ parent::__construct($out);
+
+ $this->prettifier = new PHPUnit2_Util_TestDox_NamePrettifier;
+ $this->startRun();
+ }
+
+ /**
+ * Destructor.
+ *
+ * @access public
+ */
+ public function __destruct() {
+ $this->doEndClass();
+ $this->endRun();
+
+ parent::__destruct();
+ }
+
+ /**
+ * Abstract Factory.
+ *
+ * @param string $type
+ * @param resource $out
+ * @throws Exception
+ * @access public
+ * @static
+ */
+ public static function factory($type, $out = NULL) {
+ require_once 'PHPUnit2/Util/TestDox/ResultPrinter/' . $type . '.php';
+
+ $class = 'PHPUnit2_Util_TestDox_ResultPrinter_' . $type;
+ return new $class($out);
+ }
+
+ /**
+ * An error occurred.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param Exception $e
+ * @access public
+ */
+ public function addError(PHPUnit2_Framework_Test $test, Exception $e) {
+ $this->testFailed = TRUE;
+ }
+
+ /**
+ * A failure occurred.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param PHPUnit2_Framework_AssertionFailedError $e
+ * @access public
+ */
+ public function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e) {
+ $this->testFailed = TRUE;
+ }
+
+ /**
+ * Incomplete test.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @param Exception $e
+ * @access public
+ */
+ public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e) {
+ $this->testFailed = TRUE;
+ }
+
+ /**
+ * A testsuite started.
+ *
+ * @param PHPUnit2_Framework_TestSuite $suite
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function startTestSuite(PHPUnit2_Framework_TestSuite $suite) {
+ }
+
+ /**
+ * A testsuite ended.
+ *
+ * @param PHPUnit2_Framework_TestSuite $suite
+ * @access public
+ * @since Method available since Release 2.2.0
+ */
+ public function endTestSuite(PHPUnit2_Framework_TestSuite $suite) {
+ }
+
+ /**
+ * A test started.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @access public
+ */
+ public function startTest(PHPUnit2_Framework_Test $test) {
+ $class = get_class($test);
+
+ if ($this->testClass != $class) {
+ if ($this->testClass != '') {
+ $this->doEndClass();
+ }
+
+ $this->startClass($this->prettifier->prettifyTestClass($class));
+
+ $this->testClass = $class;
+ $this->tests = array();
+ }
+
+ $this->testFailed = FALSE;
+ }
+
+ /**
+ * A test ended.
+ *
+ * @param PHPUnit2_Framework_Test $test
+ * @access public
+ */
+ public function endTest(PHPUnit2_Framework_Test $test) {
+ $prettifiedName = $this->prettifier->prettifyTestMethod($test->getName());
+
+ if (!isset($this->tests[$prettifiedName])) {
+ if (!$this->testFailed) {
+ $this->tests[$prettifiedName]['success'] = 1;
+ $this->tests[$prettifiedName]['failure'] = 0;
+ } else {
+ $this->tests[$prettifiedName]['success'] = 0;
+ $this->tests[$prettifiedName]['failure'] = 1;
+ }
+ } else {
+ if (!$this->testFailed) {
+ $this->tests[$prettifiedName]['success']++;
+ } else {
+ $this->tests[$prettifiedName]['failure']++;
+ }
+ }
+ }
+
+ /**
+ * @access private
+ * @since Method available since Release 2.3.0
+ */
+ private function doEndClass() {
+ foreach ($this->tests as $name => $data) {
+ if ($data['failure'] == 0) {
+ $this->onTest($name);
+ }
+ }
+
+ $this->endClass($this->prettifier->prettifyTestClass($this->testClass));
+ }
+
+ /**
+ * Handler for 'start run' event.
+ *
+ * @access protected
+ */
+ protected function startRun() {
+ }
+
+ /**
+ * Handler for 'start class' event.
+ *
+ * @param string $name
+ * @access protected
+ * @abstract
+ */
+ abstract protected function startClass($name);
+
+ /**
+ * Handler for 'on test' event.
+ *
+ * @param string $name
+ * @access protected
+ * @abstract
+ */
+ abstract protected function onTest($name);
+
+ /**
+ * Handler for 'end class' event.
+ *
+ * @param string $name
+ * @access protected
+ * @abstract
+ */
+ abstract protected function endClass($name);
+
+ /**
+ * Handler for 'end run' event.
+ *
+ * @access protected
+ */
+ protected function endRun() {
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/HTML.php b/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/HTML.php
new file mode 100644
index 00000000..505ec60d
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/HTML.php
@@ -0,0 +1,120 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: HTML.php,v 1.2.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+require_once 'PHPUnit2/Util/TestDox/ResultPrinter.php';
+
+/**
+ * Prints TestDox documentation in HTML format.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_TestDox_ResultPrinter_HTML extends PHPUnit2_Util_TestDox_ResultPrinter {
+ /**
+ * Handler for 'start run' event.
+ *
+ * @access protected
+ */
+ protected function startRun() {
+ $this->write('<html><body>');
+ }
+
+ /**
+ * Handler for 'start class' event.
+ *
+ * @param string $name
+ * @access protected
+ */
+ protected function startClass($name) {
+ $this->write('<h2>' . $name . '</h2><ul>');
+ }
+
+ /**
+ * Handler for 'on test' event.
+ *
+ * @param string $name
+ * @access protected
+ */
+ protected function onTest($name) {
+ $this->write('<li>' . $name . '</li>');
+ }
+
+ /**
+ * Handler for 'end class' event.
+ *
+ * @param string $name
+ * @access protected
+ */
+ protected function endClass($name) {
+ $this->write('</ul>');
+ }
+
+ /**
+ * Handler for 'end run' event.
+ *
+ * @access protected
+ */
+ protected function endRun() {
+ $this->write('</body></html>');
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>
diff --git a/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/Text.php b/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/Text.php
new file mode 100644
index 00000000..cd12e525
--- /dev/null
+++ b/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/Text.php
@@ -0,0 +1,102 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * PHP Version 5
+ *
+ * Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * Neither the name of Sebastian Bergmann nor the names of his
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version CVS: $Id: Text.php,v 1.2.2.3 2005/12/17 16:04:58 sebastian Exp $
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since File available since Release 2.3.0
+ */
+
+require_once 'PHPUnit2/Util/TestDox/ResultPrinter.php';
+
+/**
+ * Prints TestDox documentation in text format.
+ *
+ * @category Testing
+ * @package PHPUnit2
+ * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @copyright 2002-2006 Sebastian Bergmann <sb@sebastian-bergmann.de>
+ * @license http://www.opensource.org/licenses/bsd-license.php BSD License
+ * @version Release: @package_version@
+ * @link http://pear.php.net/package/PHPUnit2
+ * @since Class available since Release 2.1.0
+ */
+class PHPUnit2_Util_TestDox_ResultPrinter_Text extends PHPUnit2_Util_TestDox_ResultPrinter {
+ /**
+ * Handler for 'start class' event.
+ *
+ * @param string $name
+ * @access protected
+ */
+ protected function startClass($name) {
+ $this->write($name . "\n");
+ }
+
+ /**
+ * Handler for 'on test' event.
+ *
+ * @param string $name
+ * @access protected
+ */
+ protected function onTest($name) {
+ $this->write(' - ' . $name . "\n");
+ }
+
+ /**
+ * Handler for 'end class' event.
+ *
+ * @param string $name
+ * @access protected
+ */
+ protected function endClass($name) {
+ $this->write("\n");
+ }
+}
+
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * c-hanging-comment-ender-p: nil
+ * End:
+ */
+?>