summaryrefslogtreecommitdiff
path: root/buildscripts/PHPUnit2/Framework
diff options
context:
space:
mode:
authorctrlaltca <>2013-01-02 14:42:24 +0000
committerctrlaltca <>2013-01-02 14:42:24 +0000
commitedf2251aca60a970e822079d23933e5b70b26571 (patch)
tree366b6688efbb03f20f47268bea57859cea673c70 /buildscripts/PHPUnit2/Framework
parent8e5f2510bd577e15095e46afc7d0ba6808549bf8 (diff)
backported all related changes up to 3229 to branch/3.2
Diffstat (limited to 'buildscripts/PHPUnit2/Framework')
-rw-r--r--buildscripts/PHPUnit2/Framework/Assert.php626
-rw-r--r--buildscripts/PHPUnit2/Framework/AssertionFailedError.php80
-rw-r--r--buildscripts/PHPUnit2/Framework/ComparisonFailure.php153
-rw-r--r--buildscripts/PHPUnit2/Framework/Error.php88
-rw-r--r--buildscripts/PHPUnit2/Framework/IncompleteTest.php72
-rw-r--r--buildscripts/PHPUnit2/Framework/IncompleteTestError.php75
-rw-r--r--buildscripts/PHPUnit2/Framework/Test.php87
-rw-r--r--buildscripts/PHPUnit2/Framework/TestCase.php292
-rw-r--r--buildscripts/PHPUnit2/Framework/TestFailure.php154
-rw-r--r--buildscripts/PHPUnit2/Framework/TestListener.php135
-rw-r--r--buildscripts/PHPUnit2/Framework/TestResult.php447
-rw-r--r--buildscripts/PHPUnit2/Framework/TestSuite.php554
-rw-r--r--buildscripts/PHPUnit2/Framework/Warning.php94
13 files changed, 0 insertions, 2857 deletions
diff --git a/buildscripts/PHPUnit2/Framework/Assert.php b/buildscripts/PHPUnit2/Framework/Assert.php
deleted file mode 100644
index ef79e883..00000000
--- a/buildscripts/PHPUnit2/Framework/Assert.php
+++ /dev/null
@@ -1,626 +0,0 @@
-<?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: Assert.php,v 1.45.2.4 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/AssertionFailedError.php';
-require_once 'PHPUnit2/Framework/ComparisonFailure.php';
-
-/**
- * A set of assert methods.
- *
- * @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
- * @static
- */
-class PHPUnit2_Framework_Assert {
- /**
- * @var boolean
- * @access private
- * @static
- */
- private static $looselyTyped = FALSE;
-
- /**
- * Protect constructor since it is a static only class.
- *
- * @access protected
- */
- protected function __construct() {
- }
-
- /**
- * Asserts that a haystack contains a needle.
- *
- * @param mixed $needle
- * @param mixed $haystack
- * @param string $message
- * @access public
- * @static
- * @since Method available since Release 2.1.0
- */
- public static function assertContains($needle, $haystack, $message = '') {
- self::doAssertContains($needle, $haystack, TRUE, $message);
- }
-
- /**
- * Asserts that a haystack does not contain a needle.
- *
- * @param mixed $needle
- * @param mixed $haystack
- * @param string $message
- * @access public
- * @static
- * @since Method available since Release 2.1.0
- */
- public static function assertNotContains($needle, $haystack, $message = '') {
- self::doAssertContains($needle, $haystack, FALSE, $message);
- }
-
- /**
- * @param mixed $needle
- * @param mixed $haystack
- * @param boolean $condition
- * @param string $message
- * @throws Exception
- * @access private
- * @static
- * @since Method available since Release 2.2.0
- */
- private static function doAssertContains($needle, $haystack, $condition, $message) {
- $found = FALSE;
-
- if (is_array($haystack) ||
- (is_object($haystack) && $haystack instanceof Iterator)) {
- foreach ($haystack as $straw) {
- if ($straw === $needle) {
- $found = TRUE;
- break;
- }
- }
- }
-
- else if (is_string($needle) && is_string($haystack)) {
- if (strpos($haystack, $needle) !== FALSE) {
- $found = TRUE;
- }
- }
-
- else {
- throw new Exception;
- }
-
- if ($condition && !$found) {
- self::fail(
- sprintf(
- '%s%s"%s" does not contain "%s"',
-
- $message,
- ($message != '') ? ' ' : '',
- self::objectToString($haystack),
- self::objectToString($needle)
- )
- );
- }
-
- else if (!$condition && $found) {
- self::fail(
- sprintf(
- '%s%s"%s" contains "%s"',
-
- $message,
- ($message != '') ? ' ' : '',
- self::objectToString($haystack),
- self::objectToString($needle)
- )
- );
- }
- }
-
- /**
- * Asserts that two variables are equal.
- *
- * @param mixed $expected
- * @param mixed $actual
- * @param string $message
- * @param mixed $delta
- * @access public
- * @static
- */
- public static function assertEquals($expected, $actual, $message = '', $delta = 0) {
- self::doAssertEquals($expected, $actual, $delta, TRUE, $message);
- }
-
- /**
- * Asserts that two variables are not equal.
- *
- * @param mixed $expected
- * @param mixed $actual
- * @param string $message
- * @param mixed $delta
- * @access public
- * @static
- * @since Method available since Release 2.3.0
- */
- public static function assertNotEquals($expected, $actual, $message = '', $delta = 0) {
- self::doAssertEquals($expected, $actual, $delta, FALSE, $message);
- }
-
- /**
- * @param mixed $expected
- * @param mixed $actual
- * @param mixed $delta
- * @param boolean $condition
- * @param string $message
- * @access private
- * @static
- * @since Method available since Release 2.3.0
- */
- private static function doAssertEquals($expected, $actual, $delta, $condition, $message) {
- $equal = FALSE;
-
- if (is_array($expected)) {
- if (is_array($actual)) {
- self::sortArrayRecursively($actual);
- self::sortArrayRecursively($expected);
-
- if (self::$looselyTyped) {
- $actual = self::convertToString($actual);
- $expected = self::convertToString($expected);
- }
-
- $equal = (serialize($expected) == serialize($actual));
- }
- }
-
- else if (is_float($expected) && is_float($actual) && is_float($delta)) {
- $equal = (abs($expected - $actual) <= $delta);
- }
-
- else {
- $equal = (serialize($expected) == serialize($actual));
- }
-
- if ($condition && !$equal) {
- self::failNotSame(
- $expected,
- $actual,
- $message
- );
- }
-
- else if (!$condition && $equal) {
- self::failSame(
- $expected,
- $actual,
- $message
- );
- }
- }
-
- /**
- * Asserts that a condition is true.
- *
- * @param boolean $condition
- * @param string $message
- * @throws Exception
- * @access public
- * @static
- */
- public static function assertTrue($condition, $message = '') {
- if (is_bool($condition)) {
- if (!$condition) {
- self::fail($message);
- }
- } else {
- throw new Exception;
- }
- }
-
- /**
- * Asserts that a condition is false.
- *
- * @param boolean $condition
- * @param string $message
- * @throws Exception
- * @access public
- * @static
- */
- public static function assertFalse($condition, $message = '') {
- if (is_bool($condition)) {
- self::assertTrue(!$condition, $message);
- } else {
- throw new Exception;
- }
- }
-
- /**
- * Asserts that a variable is not NULL.
- *
- * @param mixed $actual
- * @param string $message
- * @access public
- * @static
- */
- public static function assertNotNull($actual, $message = '') {
- if (is_null($actual)) {
- self::fail(self::format('NOT NULL', 'NULL', $message));
- }
- }
-
- /**
- * Asserts that a variable is NULL.
- *
- * @param mixed $actual
- * @param string $message
- * @access public
- * @static
- */
- public static function assertNull($actual, $message = '') {
- if (!is_null($actual)) {
- self::fail(self::format('NULL', 'NOT NULL', $message));
- }
- }
-
- /**
- * Asserts that two variables have the same type and value.
- * Used on objects, it asserts that two variables reference
- * the same object.
- *
- * @param mixed $expected
- * @param mixed $actual
- * @param string $message
- * @access public
- * @static
- */
- public static function assertSame($expected, $actual, $message = '') {
- if ($expected !== $actual) {
- self::failNotSame($expected, $actual, $message);
- }
- }
-
- /**
- * Asserts that two variables do not have the same type and value.
- * Used on objects, it asserts that two variables do not reference
- * the same object.
- *
- * @param mixed $expected
- * @param mixed $actual
- * @param string $message
- * @access public
- * @static
- */
- public static function assertNotSame($expected, $actual, $message = '') {
- if ($expected === $actual) {
- self::failSame($expected, $actual, $message);
- }
- }
-
- /**
- * Asserts that a variable is of a given type.
- *
- * @param string $expected
- * @param mixed $actual
- * @param string $message
- * @access public
- * @static
- */
- public static function assertType($expected, $actual, $message = '') {
- self::doAssertType($expected, $actual, TRUE, $message);
- }
-
- /**
- * Asserts that a variable is not of a given type.
- *
- * @param string $expected
- * @param mixed $actual
- * @param string $message
- * @access public
- * @static
- * @since Method available since Release 2.2.0
- */
- public static function assertNotType($expected, $actual, $message = '') {
- self::doAssertType($expected, $actual, FALSE, $message);
- }
-
- /**
- * @param string $expected
- * @param mixed $actual
- * @param boolean $condition
- * @param string $message
- * @access private
- * @static
- * @since Method available since Release 2.2.0
- */
- private static function doAssertType($expected, $actual, $condition, $message) {
- if (!is_string($expected)) {
- throw new Exception;
- }
-
- if (is_object($actual)) {
- $result = $actual instanceof $expected;
- } else {
- $result = (gettype($actual) == $expected);
- }
-
- if ($condition && !$result) {
- self::failNotSame(
- $expected,
- $actual,
- $message
- );
- }
-
- else if (!$condition && $result) {
- self::failSame(
- $expected,
- $actual,
- $message
- );
- }
- }
-
- /**
- * Asserts that a string matches a given regular expression.
- *
- * @param string $pattern
- * @param string $string
- * @param string $message
- * @access public
- * @static
- */
- public static function assertRegExp($pattern, $string, $message = '') {
- self::doAssertRegExp($pattern, $string, TRUE, $message);
- }
-
- /**
- * Asserts that a string does not match a given regular expression.
- *
- * @param string $pattern
- * @param string $string
- * @param string $message
- * @access public
- * @static
- * @since Method available since Release 2.1.0
- */
- public static function assertNotRegExp($pattern, $string, $message = '') {
- self::doAssertRegExp($pattern, $string, FALSE, $message);
- }
-
- /**
- * @param mixed $pattern
- * @param mixed $string
- * @param boolean $condition
- * @param string $message
- * @access private
- * @static
- * @since Method available since Release 2.2.0
- */
- private static function doAssertRegExp($pattern, $string, $condition, $message) {
- if (!is_string($pattern) || !is_string($string)) {
- throw new Exception;
- }
-
- $result = preg_match($pattern, $string);
-
- if ($condition && !$result) {
- self::fail(
- sprintf(
- '%s%s"%s" does not match pattern "%s"',
-
- $message,
- ($message != '') ? ' ' : '',
- $string,
- $pattern
- )
- );
- }
-
- else if (!$condition && $result) {
- self::fail(
- sprintf(
- '%s%s"%s" matches pattern "%s"',
-
- $message,
- ($message != '') ? ' ' : '',
- $string,
- $pattern
- )
- );
- }
- }
-
- /**
- * Fails a test with the given message.
- *
- * @param string $message
- * @throws PHPUnit2_Framework_AssertionFailedError
- * @access public
- * @static
- */
- public static function fail($message = '') {
- throw new PHPUnit2_Framework_AssertionFailedError($message);
- }
-
- /**
- * @param string $message
- * @throws PHPUnit2_Framework_AssertionFailedError
- * @access private
- * @static
- */
- private static function failSame($message) {
- self::fail(
- sprintf(
- '%s%sexpected not same',
-
- $message,
- ($message != '') ? ' ' : ''
- )
- );
- }
-
- /**
- * @param mixed $expected
- * @param mixed $actual
- * @param string $message
- * @throws PHPUnit2_Framework_AssertionFailedError
- * @access private
- * @static
- */
- private static function failNotSame($expected, $actual, $message) {
- if (is_string($expected) && is_string($actual)) {
- throw new PHPUnit2_Framework_ComparisonFailure($expected, $actual, $message);
- }
-
- self::fail(
- sprintf(
- '%s%sexpected same: <%s> was not: <%s>',
-
- $message,
- ($message != '') ? ' ' : '',
- self::objectToString($expected),
- self::objectToString($actual)
- )
- );
- }
-
- /**
- * @param mixed $expected
- * @param mixed $actual
- * @param string $message
- * @access public
- * @static
- */
- public static function format($expected, $actual, $message) {
- return sprintf(
- '%s%sexpected: <%s> but was: <%s>',
-
- $message,
- ($message != '') ? ' ' : '',
- self::objectToString($expected),
- self::objectToString($actual)
- );
- }
-
- /**
- * @param boolean $looselyTyped
- * @access public
- * @static
- */
- public static function setLooselyTyped($looselyTyped) {
- if (is_bool($looselyTyped)) {
- self::$looselyTyped = $looselyTyped;
- }
- }
-
- /**
- * Converts a value to a string.
- *
- * @param mixed $value
- * @access private
- * @static
- */
- private static function convertToString($value) {
- foreach ($value as $k => $v) {
- if (is_array($v)) {
- $value[$k] = self::convertToString($value[$k]);
- } else if (is_object($v)) {
- $value[$k] = self::objectToString($value[$k]);
- } else {
- settype($value[$k], 'string');
- }
- }
-
- return $value;
- }
-
- /**
- * @param mixed $object
- * @return string
- * @access private
- * @static
- */
- private static function objectToString($object) {
- if (is_array($object) || is_object($object)) {
- $object = serialize($object);
- }
-
- return $object;
- }
-
- /**
- * Sorts an array recursively by its keys.
- *
- * @param array $array
- * @access private
- * @static
- * @author Adam Maccabee Trachtenberg <adam@trachtenberg.com>
- */
- private static function sortArrayRecursively(&$array) {
- ksort($array);
-
- foreach($array as $k => $v) {
- if (is_array($v)) {
- self::sortArrayRecursively($array[$k]);
- }
- }
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/AssertionFailedError.php b/buildscripts/PHPUnit2/Framework/AssertionFailedError.php
deleted file mode 100644
index 19bb1dc0..00000000
--- a/buildscripts/PHPUnit2/Framework/AssertionFailedError.php
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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: AssertionFailedError.php,v 1.9.2.2 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-/**
- * Thrown when an assertion failed.
- *
- * @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_Framework_AssertionFailedError extends Exception {
- /**
- * Wrapper for getMessage() which is declared as final.
- *
- * @return string
- * @access public
- */
- public function toString() {
- return $this->getMessage();
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/ComparisonFailure.php b/buildscripts/PHPUnit2/Framework/ComparisonFailure.php
deleted file mode 100644
index 6e6e5b3d..00000000
--- a/buildscripts/PHPUnit2/Framework/ComparisonFailure.php
+++ /dev/null
@@ -1,153 +0,0 @@
-<?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: ComparisonFailure.php,v 1.13.2.3 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/Assert.php';
-require_once 'PHPUnit2/Framework/AssertionFailedError.php';
-
-/**
- * Thrown when an assertion for string equality failed.
- *
- * @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_Framework_ComparisonFailure extends PHPUnit2_Framework_AssertionFailedError {
- /**
- * @var string
- * @access private
- */
- private $expected = '';
-
- /**
- * @var string
- * @access private
- */
- private $actual = '';
-
- /**
- * Constructs a comparison failure.
- *
- * @param string $expected
- * @param string $actual
- * @param string $message
- * @access public
- */
- public function __construct($expected, $actual, $message = '') {
- parent::__construct($message);
-
- $this->expected = ($expected === NULL) ? 'NULL' : $expected;
- $this->actual = ($actual === NULL) ? 'NULL' : $actual;
- }
-
- /**
- * Returns "..." in place of common prefix and "..." in
- * place of common suffix between expected and actual.
- *
- * @return string
- * @access public
- */
- public function toString() {
- $end = min(strlen($this->expected), strlen($this->actual));
- $i = 0;
- $j = strlen($this->expected) - 1;
- $k = strlen($this->actual) - 1;
-
- for (; $i < $end; $i++) {
- if ($this->expected[$i] != $this->actual[$i]) {
- break;
- }
- }
-
- for (; $k >= $i && $j >= $i; $k--,$j--) {
- if ($this->expected[$j] != $this->actual[$k]) {
- break;
- }
- }
-
- if ($j < $i && $k < $i) {
- $expected = $this->expected;
- $actual = $this->actual;
- } else {
- $expected = substr($this->expected, $i, ($j + 1 - $i));
- $actual = substr($this->actual, $i, ($k + 1 - $i));;
-
- if ($i <= $end && $i > 0) {
- $expected = '...' . $expected;
- $actual = '...' . $actual;
- }
-
- if ($j < strlen($this->expected) - 1) {
- $expected .= '...';
- }
-
- if ($k < strlen($this->actual) - 1) {
- $actual .= '...';
- }
- }
-
- return PHPUnit2_Framework_Assert::format(
- $expected,
- $actual,
- parent::getMessage()
- );
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/Error.php b/buildscripts/PHPUnit2/Framework/Error.php
deleted file mode 100644
index 2f3a3c16..00000000
--- a/buildscripts/PHPUnit2/Framework/Error.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?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: Error.php,v 1.4.2.2 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.2.0
- */
-
-/**
- * Wrapper for PHP errors.
- *
- * @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.2.0
- */
-class PHPUnit2_Framework_Error extends Exception {
- /**
- * Constructor.
- *
- * @param string $message
- * @param integer $code
- * @param string $file
- * @param integer $line
- * @param array $trace
- * @access public
- */
- public function __construct($message, $code, $file, $line, $trace) {
- parent::__construct($message, $code);
-
- $this->file = $file;
- $this->line = $line;
- $this->trace = $trace;
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/IncompleteTest.php b/buildscripts/PHPUnit2/Framework/IncompleteTest.php
deleted file mode 100644
index 0c0192a9..00000000
--- a/buildscripts/PHPUnit2/Framework/IncompleteTest.php
+++ /dev/null
@@ -1,72 +0,0 @@
-<?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: IncompleteTest.php,v 1.6.2.2 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-/**
- * A marker interface for marking any exception/error as result of an unit
- * test as incomplete implementation or currently not implemented.
- *
- * @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 Interface available since Release 2.0.0
- */
-interface PHPUnit2_Framework_IncompleteTest {
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/IncompleteTestError.php b/buildscripts/PHPUnit2/Framework/IncompleteTestError.php
deleted file mode 100644
index e0170b69..00000000
--- a/buildscripts/PHPUnit2/Framework/IncompleteTestError.php
+++ /dev/null
@@ -1,75 +0,0 @@
-<?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: IncompleteTestError.php,v 1.5.2.3 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/AssertionFailedError.php';
-require_once 'PHPUnit2/Framework/IncompleteTest.php';
-
-/**
- * Extension to PHPUnit2_Framework_AssertionFailedError to mark the special
- * case of an incomplete test.
- *
- * @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_Framework_IncompleteTestError extends PHPUnit2_Framework_AssertionFailedError implements PHPUnit2_Framework_IncompleteTest {
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/Test.php b/buildscripts/PHPUnit2/Framework/Test.php
deleted file mode 100644
index f0b98dc7..00000000
--- a/buildscripts/PHPUnit2/Framework/Test.php
+++ /dev/null
@@ -1,87 +0,0 @@
-<?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: Test.php,v 1.12.2.3 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-/**
- * A Test can be run and collect its results.
- *
- * @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 Interface available since Release 2.0.0
- */
-interface PHPUnit2_Framework_Test {
- /**
- * Counts the number of test cases that will be run by this test.
- *
- * @return integer
- * @access public
- */
- public function countTestCases();
-
- /**
- * Runs a test and collects its result in a TestResult instance.
- *
- * @param PHPUnit2_Framework_TestResult $result
- * @return PHPUnit2_Framework_TestResult
- * @access public
- */
- public function run($result = NULL);
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/TestCase.php b/buildscripts/PHPUnit2/Framework/TestCase.php
deleted file mode 100644
index b8e6a22e..00000000
--- a/buildscripts/PHPUnit2/Framework/TestCase.php
+++ /dev/null
@@ -1,292 +0,0 @@
-<?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: TestCase.php,v 1.32.2.5 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/Assert.php';
-require_once 'PHPUnit2/Framework/Error.php';
-require_once 'PHPUnit2/Framework/Test.php';
-require_once 'PHPUnit2/Framework/TestResult.php';
-
-/**
- * A TestCase defines the fixture to run multiple tests.
- *
- * To define a TestCase
- *
- * 1) Implement a subclass of PHPUnit2_Framework_TestCase.
- * 2) Define instance variables that store the state of the fixture.
- * 3) Initialize the fixture state by overriding setUp().
- * 4) Clean-up after a test by overriding tearDown().
- *
- * Each test runs in its own fixture so there can be no side effects
- * among test runs.
- *
- * Here is an example:
- *
- * <code>
- * <?php
- * require_once 'PHPUnit2/Framework/TestCase.php';
- *
- * class MathTest extends PHPUnit2_Framework_TestCase {
- * public $value1;
- * public $value2;
- *
- * public function __construct($name) {
- * parent::__construct($name);
- * }
- *
- * public function setUp() {
- * $this->value1 = 2;
- * $this->value2 = 3;
- * }
- * }
- * ?>
- * </code>
- *
- * For each test implement a method which interacts with the fixture.
- * Verify the expected results with assertions specified by calling
- * assert with a boolean.
- *
- * <code>
- * <?php
- * public function testPass() {
- * $this->assertTrue($this->value1 + $this->value2 == 5);
- * }
- * ?>
- * </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.0.0
- * @abstract
- */
-abstract class PHPUnit2_Framework_TestCase extends PHPUnit2_Framework_Assert implements PHPUnit2_Framework_Test {
- /**
- * The name of the test case.
- *
- * @var string
- * @access private
- */
- private $name = NULL;
-
- /**
- * Constructs a test case with the given name.
- *
- * @param string
- * @access public
- */
- public function __construct($name = NULL) {
- if ($name !== NULL) {
- $this->setName($name);
- }
- }
-
- /**
- * Returns a string representation of the test case.
- *
- * @return string
- * @access public
- */
- public function toString() {
- $class = new ReflectionClass($this);
-
- return sprintf(
- '%s(%s)',
-
- $this->getName(),
- $class->name
- );
- }
-
- /**
- * Counts the number of test cases executed by run(TestResult result).
- *
- * @return integer
- * @access public
- */
- public function countTestCases() {
- return 1;
- }
-
- /**
- * Gets the name of a TestCase.
- *
- * @return string
- * @access public
- */
- public function getName() {
- return $this->name;
- }
-
- /**
- * Runs the test case and collects the results in a TestResult object.
- * If no TestResult object is passed a new one will be created.
- *
- * @param PHPUnit2_Framework_TestResult $result
- * @return PHPUnit2_Framework_TestResult
- * @throws Exception
- * @access public
- */
- public function run($result = NULL) {
- if ($result === NULL) {
- $result = $this->createResult();
- }
-
- // XXX: Workaround for missing ability to declare type-hinted parameters as optional.
- else if (!($result instanceof PHPUnit2_Framework_TestResult)) {
- throw new Exception(
- 'Argument 1 must be an instance of PHPUnit2_Framework_TestResult.'
- );
- }
-
- $result->run($this);
-
- return $result;
- }
-
- /**
- * Runs the bare test sequence.
- *
- * @access public
- */
- public function runBare() {
- $catchedException = NULL;
-
- $this->setUp();
-
- try {
- $this->runTest();
- }
-
- catch (Exception $e) {
- $catchedException = $e;
- }
-
- $this->tearDown();
-
- // Workaround for missing "finally".
- if ($catchedException !== NULL) {
- throw $catchedException;
- }
- }
-
- /**
- * Override to run the test and assert its state.
- *
- * @throws PHPUnit2_Framework_Error
- * @access protected
- */
- protected function runTest() {
- if ($this->name === NULL) {
- throw new PHPUnit2_Framework_Error(
- 'PHPUnit2_Framework_TestCase::$name must not be NULL.'
- );
- }
-
- try {
- $class = new ReflectionClass($this);
- $method = $class->getMethod($this->name);
- }
-
- catch (ReflectionException $e) {
- $this->fail($e->getMessage());
- }
-
- $method->invoke($this);
- }
-
- /**
- * Sets the name of a TestCase.
- *
- * @param string
- * @access public
- */
- public function setName($name) {
- $this->name = $name;
- }
-
- /**
- * Creates a default TestResult object.
- *
- * @return PHPUnit2_Framework_TestResult
- * @access protected
- */
- protected function createResult() {
- return new PHPUnit2_Framework_TestResult;
- }
-
- /**
- * 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() {
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/TestFailure.php b/buildscripts/PHPUnit2/Framework/TestFailure.php
deleted file mode 100644
index 848fbfa1..00000000
--- a/buildscripts/PHPUnit2/Framework/TestFailure.php
+++ /dev/null
@@ -1,154 +0,0 @@
-<?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: TestFailure.php,v 1.10.2.3 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/AssertionFailedError.php';
-require_once 'PHPUnit2/Framework/Test.php';
-
-/**
- * A TestFailure collects a failed test together with the caught exception.
- *
- * @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_Framework_TestFailure {
- /**
- * @var PHPUnit2_Framework_Test
- * @access protected
- */
- protected $failedTest;
-
- /**
- * @var Exception
- * @access protected
- */
- protected $thrownException;
-
- /**
- * Constructs a TestFailure with the given test and exception.
- *
- * @param PHPUnit2_Framework_Test $failedTest
- * @param Exception $thrownException
- * @access public
- */
- public function __construct(PHPUnit2_Framework_Test $failedTest, Exception $thrownException) {
- $this->failedTest = $failedTest;
- $this->thrownException = $thrownException;
- }
-
- /**
- * Returns a short description of the failure.
- *
- * @return string
- * @access public
- */
- public function toString() {
- return sprintf(
- '%s: %s',
-
- $this->failedTest,
- $this->thrownException->getMessage()
- );
- }
-
- /**
- * Gets the failed test.
- *
- * @return Test
- * @access public
- */
- public function failedTest() {
- return $this->failedTest;
- }
-
- /**
- * Gets the thrown exception.
- *
- * @return Exception
- * @access public
- */
- public function thrownException() {
- return $this->thrownException;
- }
-
- /**
- * Returns the exception's message.
- *
- * @return string
- * @access public
- */
- public function exceptionMessage() {
- return $this->thrownException()->getMessage();
- }
-
- /**
- * Returns TRUE if the thrown exception
- * is of type AssertionFailedError.
- *
- * @return boolean
- * @access public
- */
- public function isFailure() {
- return ($this->thrownException() instanceof PHPUnit2_Framework_AssertionFailedError);
- }
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/TestListener.php b/buildscripts/PHPUnit2/Framework/TestListener.php
deleted file mode 100644
index 5a4dcb1a..00000000
--- a/buildscripts/PHPUnit2/Framework/TestListener.php
+++ /dev/null
@@ -1,135 +0,0 @@
-<?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: TestListener.php,v 1.11.2.3 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/AssertionFailedError.php';
-require_once 'PHPUnit2/Framework/TestSuite.php';
-
-/**
- * A Listener for test progress.
- *
- * @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 Interface available since Release 2.0.0
- */
-interface PHPUnit2_Framework_TestListener {
- /**
- * An error occurred.
- *
- * @param PHPUnit2_Framework_Test $test
- * @param Exception $e
- * @access public
- */
- public function addError(PHPUnit2_Framework_Test $test, Exception $e);
-
- /**
- * 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);
-
- /**
- * Incomplete test.
- *
- * @param PHPUnit2_Framework_Test $test
- * @param Exception $e
- * @access public
- */
- public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e);
-
- /**
- * 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);
-
- /**
- * 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);
-
- /**
- * A test started.
- *
- * @param PHPUnit2_Framework_Test $test
- * @access public
- */
- public function startTest(PHPUnit2_Framework_Test $test);
-
- /**
- * A test ended.
- *
- * @param PHPUnit2_Framework_Test $test
- * @access public
- */
- public function endTest(PHPUnit2_Framework_Test $test);
-}
-
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/TestResult.php b/buildscripts/PHPUnit2/Framework/TestResult.php
deleted file mode 100644
index 0cb854c7..00000000
--- a/buildscripts/PHPUnit2/Framework/TestResult.php
+++ /dev/null
@@ -1,447 +0,0 @@
-<?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: TestResult.php,v 1.32.2.7 2006/02/25 09:44:23 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/AssertionFailedError.php';
-require_once 'PHPUnit2/Framework/IncompleteTest.php';
-require_once 'PHPUnit2/Framework/TestFailure.php';
-require_once 'PHPUnit2/Framework/TestListener.php';
-require_once 'PHPUnit2/Util/ErrorHandler.php';
-require_once 'PHPUnit2/Util/Filter.php';
-
-/**
- * A TestResult collects the results of executing a test case.
- *
- * @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_Framework_TestResult {
- /**
- * @var array
- * @access protected
- */
- protected $errors = array();
-
- /**
- * @var array
- * @access protected
- */
- protected $failures = array();
-
- /**
- * @var array
- * @access protected
- */
- protected $notImplemented = array();
-
- /**
- * @var array
- * @access protected
- */
- protected $listeners = array();
-
- /**
- * @var integer
- * @access protected
- */
- protected $runTests = 0;
-
- /**
- * Code Coverage information provided by Xdebug.
- *
- * @var array
- * @access protected
- */
- protected $codeCoverageInformation = array();
-
- /**
- * @var boolean
- * @access protected
- */
- protected $collectCodeCoverageInformation = FALSE;
-
- /**
- * @var boolean
- * @access private
- */
- private $stop = FALSE;
-
- /**
- * Registers a TestListener.
- *
- * @param PHPUnit2_Framework_TestListener
- * @access public
- */
- public function addListener(PHPUnit2_Framework_TestListener $listener) {
- $this->listeners[] = $listener;
- }
-
- /**
- * Unregisters a TestListener.
- *
- * @param PHPUnit2_Framework_TestListener $listener
- * @access public
- */
- public function removeListener(PHPUnit2_Framework_TestListener $listener) {
- for ($i = 0; $i < sizeof($this->listeners); $i++) {
- if ($this->listeners[$i] === $listener) {
- unset($this->listeners[$i]);
- }
- }
- }
-
- /**
- * Adds an error to the list of errors.
- * The passed in exception caused the error.
- *
- * @param PHPUnit2_Framework_Test $test
- * @param Exception $e
- * @access public
- */
- public function addError(PHPUnit2_Framework_Test $test, Exception $e) {
- if ($e instanceof PHPUnit2_Framework_IncompleteTest) {
- $this->notImplemented[] = new PHPUnit2_Framework_TestFailure($test, $e);
-
- foreach ($this->listeners as $listener) {
- $listener->addIncompleteTest($test, $e);
- }
- } else {
- $this->errors[] = new PHPUnit2_Framework_TestFailure($test, $e);
-
- foreach ($this->listeners as $listener) {
- $listener->addError($test, $e);
- }
- }
- }
-
- /**
- * Adds a failure to the list of failures.
- * The passed in exception caused the failure.
- *
- * @param PHPUnit2_Framework_Test $test
- * @param PHPUnit2_Framework_AssertionFailedError $e
- * @access public
- */
- public function addFailure(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e) {
- if ($e instanceof PHPUnit2_Framework_IncompleteTest) {
- $this->notImplemented[] = new PHPUnit2_Framework_TestFailure($test, $e);
-
- foreach ($this->listeners as $listener) {
- $listener->addIncompleteTest($test, $e);
- }
- } else {
- $this->failures[] = new PHPUnit2_Framework_TestFailure($test, $e);
-
- foreach ($this->listeners as $listener) {
- $listener->addFailure($test, $e);
- }
- }
- }
-
- /**
- * Informs the result that a testsuite will be started.
- *
- * @param PHPUnit2_Framework_TestSuite $suite
- * @access public
- * @since Method available since Release 2.2.0
- */
- public function startTestSuite(PHPUnit2_Framework_TestSuite $suite) {
- foreach ($this->listeners as $listener) {
- $listener->startTestSuite($suite);
- }
- }
-
- /**
- * Informs the result that a testsuite was completed.
- *
- * @param PHPUnit2_Framework_TestSuite $suite
- * @access public
- * @since Method available since Release 2.2.0
- */
- public function endTestSuite(PHPUnit2_Framework_TestSuite $suite) {
- foreach ($this->listeners as $listener) {
- $listener->endTestSuite($suite);
- }
- }
-
- /**
- * Informs the result that a test will be started.
- *
- * @param PHPUnit2_Framework_Test $test
- * @access public
- */
- public function startTest(PHPUnit2_Framework_Test $test) {
- $this->runTests += $test->countTestCases();
-
- foreach ($this->listeners as $listener) {
- $listener->startTest($test);
- }
- }
-
- /**
- * Informs the result that a test was completed.
- *
- * @param PHPUnit2_Framework_Test
- * @access public
- */
- public function endTest(PHPUnit2_Framework_Test $test) {
- foreach ($this->listeners as $listener) {
- $listener->endTest($test);
- }
- }
-
- /**
- * Returns TRUE if no incomplete test occured.
- *
- * @return boolean
- * @access public
- */
- public function allCompletlyImplemented() {
- return $this->notImplementedCount() == 0;
- }
-
- /**
- * Gets the number of incomplete tests.
- *
- * @return integer
- * @access public
- */
- public function notImplementedCount() {
- return sizeof($this->notImplemented);
- }
-
- /**
- * Returns an Enumeration for the incomplete tests.
- *
- * @return array
- * @access public
- */
- public function notImplemented() {
- return $this->notImplemented;
- }
-
- /**
- * Gets the number of detected errors.
- *
- * @return integer
- * @access public
- */
- public function errorCount() {
- return sizeof($this->errors);
- }
-
- /**
- * Returns an Enumeration for the errors.
- *
- * @return array
- * @access public
- */
- public function errors() {
- return $this->errors;
- }
-
- /**
- * Gets the number of detected failures.
- *
- * @return integer
- * @access public
- */
- public function failureCount() {
- return sizeof($this->failures);
- }
-
- /**
- * Returns an Enumeration for the failures.
- *
- * @return array
- * @access public
- */
- public function failures() {
- return $this->failures;
- }
-
- /**
- * Enables or disables the collection of Code Coverage information.
- *
- * @param boolean $flag
- * @throws Exception
- * @access public
- * @since Method available since Release 2.3.0
- */
- public function collectCodeCoverageInformation($flag) {
- if (is_bool($flag)) {
- $this->collectCodeCoverageInformation = $flag;
- } else {
- throw new Exception;
- }
- }
-
- /**
- * Returns Code Coverage data per test case.
- *
- * Format of the result array:
- *
- * <code>
- * array(
- * "testCase" => array(
- * "/tested/code.php" => array(
- * linenumber => flag
- * )
- * )
- * )
- * </code>
- *
- * flag < 0: Line is executable but was not executed.
- * flag > 0: Line was executed.
- *
- * @return array
- * @access public
- */
- public function getCodeCoverageInformation() {
- return $this->codeCoverageInformation;
- }
-
- /**
- * Runs a TestCase.
- *
- * @param PHPUnit2_Framework_Test $test
- * @access public
- */
- public function run(PHPUnit2_Framework_Test $test) {
- $this->startTest($test);
-
- set_error_handler('PHPUnit2_Util_ErrorHandler', E_USER_ERROR);
-
- $useXdebug = (extension_loaded('xdebug') && $this->collectCodeCoverageInformation);
-
- if ($useXdebug) {
- xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
- }
-
- $globalsBackup = $GLOBALS;
-
- try {
- $test->runBare();
- }
-
- catch (PHPUnit2_Framework_AssertionFailedError $e) {
- $this->addFailure($test, $e);
- }
-
- catch (Exception $e) {
- $this->addError($test, $e);
- }
-
- $GLOBALS = $globalsBackup;
-
- if ($useXdebug) {
- $this->codeCoverageInformation[$test->getName()] = PHPUnit2_Util_Filter::getFilteredCodeCoverage(
- xdebug_get_code_coverage()
- );
-
- xdebug_stop_code_coverage();
- }
-
- restore_error_handler();
-
- $this->endTest($test);
- }
-
- /**
- * Gets the number of run tests.
- *
- * @return integer
- * @access public
- */
- public function runCount() {
- return $this->runTests;
- }
-
- /**
- * Checks whether the test run should stop.
- *
- * @return boolean
- * @access public
- */
- public function shouldStop() {
- return $this->stop;
- }
-
- /**
- * Marks that the test run should stop.
- *
- * @access public
- */
- public function stop() {
- $this->stop = TRUE;
- }
-
- /**
- * Returns whether the entire test was successful or not.
- *
- * @return boolean
- * @access public
- */
- public function wasSuccessful() {
- return empty($this->errors) && empty($this->failures);
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/TestSuite.php b/buildscripts/PHPUnit2/Framework/TestSuite.php
deleted file mode 100644
index 12c4ce5a..00000000
--- a/buildscripts/PHPUnit2/Framework/TestSuite.php
+++ /dev/null
@@ -1,554 +0,0 @@
-<?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: TestSuite.php,v 1.26.2.11 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/Test.php';
-require_once 'PHPUnit2/Framework/TestCase.php';
-require_once 'PHPUnit2/Framework/TestResult.php';
-require_once 'PHPUnit2/Runner/BaseTestRunner.php';
-require_once 'PHPUnit2/Util/Fileloader.php';
-
-/**
- * A TestSuite is a composite of Tests. It runs a collection of test cases.
- *
- * Here is an example using the dynamic test definition.
- *
- * <code>
- * <?php
- * $suite = new PHPUnit2_Framework_TestSuite;
- * $suite->addTest(new MathTest('testPass'));
- * ?>
- * </code>
- *
- * Alternatively, a TestSuite can extract the tests to be run automatically.
- * To do so you pass a ReflectionClass instance for your
- * PHPUnit2_Framework_TestCase class to the PHPUnit2_Framework_TestSuite
- * constructor.
- *
- * <code>
- * <?php
- * $suite = new PHPUnit2_Framework_TestSuite(
- * new ReflectionClass('MathTest')
- * );
- * ?>
- * </code>
- *
- * This constructor creates a suite with all the methods starting with
- * "test" that take no arguments.
- *
- * @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_Framework_TestSuite implements PHPUnit2_Framework_Test {
- /**
- * The name of the test suite.
- *
- * @var string
- * @access private
- */
- private $name = '';
-
- /**
- * The tests in the test suite.
- *
- * @var array
- * @access private
- */
- private $tests = array();
-
- /**
- * Constructs a new TestSuite:
- *
- * - PHPUnit2_Framework_TestSuite() constructs an empty TestSuite.
- *
- * - PHPUnit2_Framework_TestSuite(ReflectionClass) constructs a
- * TestSuite from the given class.
- *
- * - PHPUnit2_Framework_TestSuite(ReflectionClass, String)
- * constructs a TestSuite from the given class with the given
- * name.
- *
- * - PHPUnit2_Framework_TestSuite(String) either constructs a
- * TestSuite from the given class (if the passed string is the
- * name of an existing class) or constructs an empty TestSuite
- * with the given name.
- *
- * @param mixed $theClass
- * @param string $name
- * @throws Exception
- * @access public
- */
- public function __construct($theClass = '', $name = '') {
- $argumentsValid = FALSE;
-
- if (is_object($theClass) &&
- $theClass instanceof ReflectionClass) {
- $argumentsValid = TRUE;
- }
-
- else if (is_string($theClass) && $theClass !== '' && class_exists($theClass)) {
- $argumentsValid = TRUE;
-
- if ($name == '') {
- $name = $theClass;
- }
-
- $theClass = new ReflectionClass($theClass);
- }
-
- else if (is_string($theClass)) {
- $this->setName($theClass);
- return;
- }
-
- if (!$argumentsValid) {
- throw new Exception;
- }
-
- if ($name != '') {
- $this->setName($name);
- } else {
- $this->setName($theClass->getName());
- }
-
- $constructor = $theClass->getConstructor();
-
- if ($constructor === NULL ||
- !$constructor->isPublic()) {
- $this->addTest(
- self::warning(
- sprintf(
- 'Class %s has no public constructor',
-
- $theClass->getName()
- )
- )
- );
-
- return;
- }
-
- $methods = $theClass->getMethods();
- $names = array();
-
- foreach ($methods as $method) {
- $this->addTestMethod($method, $names, $theClass);
- }
-
- if (empty($this->tests)) {
- $this->addTest(
- self::warning(
- sprintf(
- 'No tests found in %s',
-
- $theClass->getName()
- )
- )
- );
- }
- }
-
- /**
- * Returns a string representation of the test suite.
- *
- * @return string
- * @access public
- */
- public function toString() {
- return $this->getName();
- }
-
- /**
- * Adds a test to the suite.
- *
- * @param PHPUnit2_Framework_Test $test
- * @access public
- */
- public function addTest(PHPUnit2_Framework_Test $test) {
- $this->tests[] = $test;
- }
-
- /**
- * Adds the tests from the given class to the suite.
- *
- * @param mixed $testClass
- * @access public
- */
- public function addTestSuite($testClass) {
- if (is_string($testClass) &&
- class_exists($testClass)) {
- $testClass = new ReflectionClass($testClass);
- }
-
- if (is_object($testClass) &&
- $testClass instanceof ReflectionClass) {
- $this->addTest(new PHPUnit2_Framework_TestSuite($testClass));
- }
- }
-
- /**
- * Wraps both <code>addTest()</code> and <code>addTestSuite</code>
- * as well as the separate import statements for the user's convenience.
- *
- * If the named file cannot be read or there are no new tests that can be
- * added, a <code>PHPUnit2_Framework_Warning</code> will be created instead,
- * leaving the current test run untouched.
- *
- * @param string $filename
- * @throws Exception
- * @access public
- * @since Method available since Release 2.3.0
- * @author Stefano F. Rausch <stefano@rausch-e.net>
- */
- public function addTestFile($filename) {
- if (!is_string($filename) || !file_exists($filename)) {
- throw new Exception;
- }
-
- $declaredClasses = get_declared_classes();
-
- PHPUnit2_Util_Fileloader::checkAndLoad($filename);
-
- $newClasses = array_values(
- array_diff(get_declared_classes(), $declaredClasses)
- );
-
- $testsFound = 0;
-
- foreach ($newClasses as $class) {
- if (preg_match('"Tests?$"', $class)) {
- try {
- $suiteMethod = new ReflectionMethod(
- $class, PHPUnit2_Runner_BaseTestRunner::SUITE_METHODNAME
- );
-
- $this->addTest($suiteMethod->invoke(NULL));
- } catch (ReflectionException $e) {
- $this->addTestSuite(new ReflectionClass($class));
- }
-
- $testsFound++;
- }
- }
-
- if ($testsFound == 0) {
- $this->addTest(
- new PHPUnit2_Framework_Warning('No tests found in file ' . $filename)
- );
- }
- }
-
- /**
- * Wrapper for addTestFile() that adds multiple test files.
- *
- * @param Array $filenames
- * @throws Exception
- * @access public
- * @since Method available since Release 2.3.0
- */
- public function addTestFiles($filenames) {
- foreach ($filenames as $filename) {
- $this->addTestFile($filename);
- }
- }
-
- /**
- * Counts the number of test cases that will be run by this test.
- *
- * @return integer
- * @access public
- */
- public function countTestCases() {
- $count = 0;
-
- foreach ($this->tests as $test) {
- $count += $test->countTestCases();
- }
-
- return $count;
- }
-
- /**
- * @param ReflectionClass $theClass
- * @param string $name
- * @return PHPUnit2_Framework_Test
- * @access public
- * @static
- */
- public static function createTest(ReflectionClass $theClass, $name) {
- if (!$theClass->isInstantiable()) {
- return self::warning(
- sprintf(
- 'Cannot instantiate test case %s.',
- $theClass->getName()
- )
- );
- }
-
- $constructor = $theClass->getConstructor();
-
- if ($constructor !== NULL) {
- $parameters = $constructor->getParameters();
-
- if (sizeof($parameters) == 0) {
- $test = $theClass->newInstance();
-
- if ($test instanceof PHPUnit2_Framework_TestCase) {
- $test->setName($name);
- }
- }
-
- else if (sizeof($parameters) == 1 &&
- $parameters[0]->getClass() === NULL) {
- $test = $theClass->newInstance($name);
- }
-
- else {
- return self::warning(
- sprintf(
- 'Constructor of class %s is not TestCase($name) or TestCase().',
- $theClass->getName()
- )
- );
- }
- }
-
- return $test;
- }
-
- /**
- * Creates a default TestResult object.
- *
- * @return PHPUnit2_Framework_TestResult
- * @access protected
- */
- protected function createResult() {
- return new PHPUnit2_Framework_TestResult;
- }
-
- /**
- * Returns the name of the suite.
- *
- * @return string
- * @access public
- */
- public function getName() {
- return $this->name;
- }
-
- /**
- * Runs the tests and collects their result in a TestResult.
- *
- * @param PHPUnit2_Framework_TestResult $result
- * @return PHPUnit2_Framework_TestResult
- * @throws Exception
- * @access public
- */
- public function run($result = NULL) {
- if ($result === NULL) {
- $result = $this->createResult();
- }
-
- // XXX: Workaround for missing ability to declare type-hinted parameters as optional.
- else if (!($result instanceof PHPUnit2_Framework_TestResult)) {
- throw new Exception(
- 'Argument 1 must be an instance of PHPUnit2_Framework_TestResult.'
- );
- }
-
- $result->startTestSuite($this);
-
- foreach ($this->tests as $test) {
- if ($result->shouldStop()) {
- break;
- }
-
- $this->runTest($test, $result);
- }
-
- $result->endTestSuite($this);
-
- return $result;
- }
-
- /**
- * Runs a test.
- *
- * @param PHPUnit2_Framework_Test $test
- * @param PHPUnit2_Framework_TestResult $testResult
- * @access public
- */
- public function runTest(PHPUnit2_Framework_Test $test, PHPUnit2_Framework_TestResult $result) {
- $test->run($result);
- }
-
- /**
- * Sets the name of the suite.
- *
- * @param string
- * @access public
- */
- public function setName($name) {
- $this->name = $name;
- }
-
- /**
- * Returns the test at the given index.
- *
- * @param integer
- * @return PHPUnit2_Framework_Test
- * @access public
- */
- public function testAt($index) {
- if (isset($this->tests[$index])) {
- return $this->tests[$index];
- } else {
- return FALSE;
- }
- }
-
- /**
- * Returns the number of tests in this suite.
- *
- * @return integer
- * @access public
- */
- public function testCount() {
- return sizeof($this->tests);
- }
-
- /**
- * Returns the tests as an enumeration.
- *
- * @return array
- * @access public
- */
- public function tests() {
- return $this->tests;
- }
-
- /**
- * @param ReflectionMethod $method
- * @param array $names
- * @param ReflectionClass $theClass
- * @access private
- */
- private function addTestMethod(ReflectionMethod $method, &$names, ReflectionClass $theClass) {
- $name = $method->getName();
-
- if (in_array($name, $names)) {
- return;
- }
-
- if ($this->isPublicTestMethod($method)) {
- $names[] = $name;
-
- $this->addTest(
- self::createTest(
- $theClass,
- $name
- )
- );
- }
-
- else if ($this->isTestMethod($method)) {
- $this->addTest(
- self::warning(
- sprintf(
- 'Test method is not public: %s',
-
- $name
- )
- )
- );
- }
- }
-
- /**
- * @param ReflectionMethod $method
- * @return boolean
- * @access private
- */
- private function isPublicTestMethod(ReflectionMethod $method) {
- return ($this->isTestMethod($method) &&
- $method->isPublic());
- }
-
- /**
- * @param ReflectionMethod $method
- * @return boolean
- * @access private
- */
- private function isTestMethod(ReflectionMethod $method) {
- return (substr($method->name, 0, 4) == 'test');
- }
-
- /**
- * @param string $message
- * @return PHPUnit2_Framework_Warning
- * @access private
- */
- private static function warning($message) {
- require_once 'PHPUnit2/Framework/Warning.php';
- return new PHPUnit2_Framework_Warning($message);
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>
diff --git a/buildscripts/PHPUnit2/Framework/Warning.php b/buildscripts/PHPUnit2/Framework/Warning.php
deleted file mode 100644
index 6e5c072f..00000000
--- a/buildscripts/PHPUnit2/Framework/Warning.php
+++ /dev/null
@@ -1,94 +0,0 @@
-<?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: Warning.php,v 1.11.2.3 2005/12/17 16:04:56 sebastian Exp $
- * @link http://pear.php.net/package/PHPUnit2
- * @since File available since Release 2.0.0
- */
-
-require_once 'PHPUnit2/Framework/TestCase.php';
-
-/**
- * A warning.
- *
- * @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_Framework_Warning extends PHPUnit2_Framework_TestCase {
- /**
- * @var string
- * @access private
- */
- private $message = '';
-
- /**
- * @param string $message
- * @access public
- */
- public function __construct($message = '') {
- $this->message = $message;
- parent::__construct('Warning');
- }
-
- /**
- * @access protected
- */
- protected function runTest() {
- $this->fail($this->message);
- }
-}
-
-/*
- * Local variables:
- * tab-width: 4
- * c-basic-offset: 4
- * c-hanging-comment-ender-p: nil
- * End:
- */
-?>