diff options
Diffstat (limited to 'buildscripts/PHPUnit2')
42 files changed, 0 insertions, 8187 deletions
diff --git a/buildscripts/PHPUnit2/Extensions/ExceptionTestCase.php b/buildscripts/PHPUnit2/Extensions/ExceptionTestCase.php deleted file mode 100644 index ababf9c5..00000000 --- a/buildscripts/PHPUnit2/Extensions/ExceptionTestCase.php +++ /dev/null @@ -1,122 +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: ExceptionTestCase.php,v 1.15.2.6 2006/02/20 07:42:59 sebastian Exp $ - * @link http://pear.php.net/package/PHPUnit2 - * @since File available since Release 2.0.0 - */ - -require_once 'PHPUnit2/Framework/TestCase.php'; - -/** - * A TestCase that expects a specified Exception to be thrown. - * - * @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_Extensions_ExceptionTestCase extends PHPUnit2_Framework_TestCase { - /** - * The name of the expected Exception. - * - * @var mixed - * @access private - */ - private $expectedException = NULL; - - /** - * @return string - * @access public - * @since Method available since Release 2.2.0 - */ - public function getExpectedException() { - return $this->expectedException; - } - - /** - * @param mixed $exceptionName - * @access public - * @since Method available since Release 2.2.0 - */ - public function setExpectedException($exceptionName) { - if ((is_string($exceptionName) && class_exists($exceptionName)) || $exceptionName === NULL) { - $this->expectedException = $exceptionName; - } - } - - /** - * @access protected - */ - protected function runTest() { - try { - parent::runTest(); - } - - catch (Exception $e) { - if ($this->expectedException !== NULL && - $e instanceof $this->expectedException) { - return; - } else { - throw $e; - } - } - - if ($this->expectedException !== NULL) { - $this->fail('Expected exception ' . $this->expectedException); - } - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Extensions/PerformanceTestCase.php b/buildscripts/PHPUnit2/Extensions/PerformanceTestCase.php deleted file mode 100644 index 4d10f062..00000000 --- a/buildscripts/PHPUnit2/Extensions/PerformanceTestCase.php +++ /dev/null @@ -1,128 +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: PerformanceTestCase.php,v 1.15.2.5 2005/12/17 16:04:56 sebastian Exp $ - * @link http://pear.php.net/package/PHPUnit2 - * @since File available since Release 2.1.0 - */ - -require_once 'PHPUnit2/Framework/TestCase.php'; - -require_once 'Benchmark/Timer.php'; - -/** - * A TestCase that expects a TestCase to be executed - * meeting a given time limit. - * - * @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_Extensions_PerformanceTestCase extends PHPUnit2_Framework_TestCase { - /** - * @var integer - * @access private - */ - private $maxRunningTime = 0; - - /** - * @access protected - */ - protected function runTest() { - $timer = new Benchmark_Timer; - - $timer->start(); - parent::runTest(); - $timer->stop(); - - if ($this->maxRunningTime != 0 && - $timer->timeElapsed() > $this->maxRunningTime) { - $this->fail( - sprintf( - 'expected running time: <= %s but was: %s', - - $this->maxRunningTime, - $timer->timeElapsed() - ) - ); - } - } - - /** - * @param integer $maxRunningTime - * @throws Exception - * @access public - * @since Method available since Release 2.3.0 - */ - public function setMaxRunningTime($maxRunningTime) { - if (is_integer($maxRunningTime) && - $maxRunningTime >= 0) { - $this->maxRunningTime = $maxRunningTime; - } else { - throw new Exception; - } - } - - /** - * @return integer - * @access public - * @since Method available since Release 2.3.0 - */ - public function getMaxRunningTime() { - return $this->maxRunningTime; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Extensions/RepeatedTest.php b/buildscripts/PHPUnit2/Extensions/RepeatedTest.php deleted file mode 100644 index b842aa1b..00000000 --- a/buildscripts/PHPUnit2/Extensions/RepeatedTest.php +++ /dev/null @@ -1,138 +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: RepeatedTest.php,v 1.15.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/Extensions/TestDecorator.php'; - -/** - * A Decorator that runs a test repeatedly. - * - * @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_Extensions_RepeatedTest extends PHPUnit2_Extensions_TestDecorator { - /** - * @var integer - * @access private - */ - private $timesRepeat = 1; - - /** - * Constructor. - * - * @param PHPUnit2_Framework_Test $test - * @param integer $timesRepeat - * @throws Exception - * @access public - */ - public function __construct(PHPUnit2_Framework_Test $test, $timesRepeat = 1) { - parent::__construct($test); - - if (is_integer($timesRepeat) && - $timesRepeat >= 0) { - $this->timesRepeat = $timesRepeat; - } else { - throw new Exception( - 'Argument 2 must be a positive integer.' - ); - } - } - - /** - * Counts the number of test cases that - * will be run by this test. - * - * @return integer - * @access public - */ - public function countTestCases() { - return $this->timesRepeat * $this->test->countTestCases(); - } - - /** - * Runs the decorated test and collects the - * 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.' - ); - } - - for ($i = 0; $i < $this->timesRepeat && !$result->shouldStop(); $i++) { - $this->test->run($result); - } - - return $result; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Extensions/TestDecorator.php b/buildscripts/PHPUnit2/Extensions/TestDecorator.php deleted file mode 100644 index ebca6e1f..00000000 --- a/buildscripts/PHPUnit2/Extensions/TestDecorator.php +++ /dev/null @@ -1,174 +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: TestDecorator.php,v 1.14.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/Assert.php'; -require_once 'PHPUnit2/Framework/Test.php'; -require_once 'PHPUnit2/Framework/TestResult.php'; - -/** - * A Decorator for Tests. - * - * Use TestDecorator as the base class for defining new - * test decorators. Test decorator subclasses can be introduced - * to add behaviour before or after a test is run. - * - * @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_Extensions_TestDecorator extends PHPUnit2_Framework_Assert implements PHPUnit2_Framework_Test { - /** - * The Test to be decorated. - * - * @var object - * @access protected - */ - protected $test = NULL; - - /** - * Constructor. - * - * @param PHPUnit2_Framework_Test $test - * @access public - */ - public function __construct(PHPUnit2_Framework_Test $test) { - $this->test = $test; - } - - /** - * Returns a string representation of the test. - * - * @return string - * @access public - */ - public function toString() { - return $this->test->toString(); - } - - /** - * Runs the test and collects the - * result in a TestResult. - * - * @param PHPUnit2_Framework_TestResult $result - * @access public - */ - public function basicRun(PHPUnit2_Framework_TestResult $result) { - $this->test->run($result); - } - - /** - * Counts the number of test cases that - * will be run by this test. - * - * @return integer - * @access public - */ - public function countTestCases() { - return $this->test->countTestCases(); - } - - /** - * Creates a default TestResult object. - * - * @return PHPUnit2_Framework_TestResult - * @access protected - */ - protected function createResult() { - return new PHPUnit2_Framework_TestResult; - } - - /** - * Returns the test to be run. - * - * @return PHPUnit2_Framework_Test - * @access public - */ - public function getTest() { - return $this->test; - } - - /** - * Runs the decorated test and collects the - * 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.' - ); - } - - $this->basicRun($result); - - return $result; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Extensions/TestSetup.php b/buildscripts/PHPUnit2/Extensions/TestSetup.php deleted file mode 100644 index 153cfcf1..00000000 --- a/buildscripts/PHPUnit2/Extensions/TestSetup.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: TestSetup.php,v 1.13.2.6 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/TestSuite.php'; -require_once 'PHPUnit2/Extensions/TestDecorator.php'; - -/** - * A Decorator to set up and tear down additional fixture state. - * Subclass TestSetup and insert it into your tests when you want - * to set up additional state once before the tests are run. - * - * @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_Extensions_TestSetup extends PHPUnit2_Extensions_TestDecorator { - /** - * Runs the decorated test and collects the - * 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.' - ); - } - - $this->setUp(); - $this->copyFixtureToTest(); - $this->basicRun($result); - $this->tearDown(); - - return $result; - } - - /** - * Copies the fixture set up by setUp() to the test. - * - * @access private - * @since Method available since Release 2.3.0 - */ - private function copyFixtureToTest() { - $object = new ReflectionClass($this); - - foreach ($object->getProperties() as $property) { - $name = $property->getName(); - - if ($name != 'test') { - $this->doCopyFixtureToTest($this->test, $name, $this->$name); - } - } - } - - /** - * @access private - * @since Method available since Release 2.3.0 - */ - private function doCopyFixtureToTest($object, $name, &$value) { - if ($object instanceof PHPUnit2_Framework_TestSuite) { - foreach ($object->tests() as $test) { - $this->doCopyFixtureToTest($test, $name, $value); - } - } else { - $object->$name =& $value; - } - } - - /** - * Sets up the fixture. Override to set up additional fixture - * state. - * - * @access protected - */ - protected function setUp() { - } - - /** - * Tears down the fixture. Override to tear down the additional - * fixture state. - * - * @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/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: - */ -?> diff --git a/buildscripts/PHPUnit2/Runner/BaseTestRunner.php b/buildscripts/PHPUnit2/Runner/BaseTestRunner.php deleted file mode 100644 index 189309b8..00000000 --- a/buildscripts/PHPUnit2/Runner/BaseTestRunner.php +++ /dev/null @@ -1,283 +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: BaseTestRunner.php,v 1.18.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/TestListener.php'; -require_once 'PHPUnit2/Runner/StandardTestSuiteLoader.php'; - -/** - * Base class for all test runners. - * - * @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_Runner_BaseTestRunner implements PHPUnit2_Framework_TestListener { - const STATUS_ERROR = 1; - const STATUS_FAILURE = 2; - const STATUS_INCOMPLETE = 3; - const SUITE_METHODNAME = 'suite'; - - /** - * An error occurred. - * - * @param PHPUnit2_Framework_Test $test - * @param Exception $e - * @access public - */ - public function addError(PHPUnit2_Framework_Test $test, Exception $e) { - $this->testFailed(self::STATUS_ERROR, $test, $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) { - $this->testFailed(self::STATUS_FAILURE, $test, $e); - } - - /** - * Incomplete test. - * - * @param PHPUnit2_Framework_Test $test - * @param Exception $e - * @access public - */ - public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e) { - $this->testFailed(self::STATUS_INCOMPLETE, $test, $e); - } - - /** - * 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) { - $this->testStarted($test->getName()); - } - - /** - * A test ended. - * - * @param PHPUnit2_Framework_Test $test - * @access public - */ - public function endTest(PHPUnit2_Framework_Test $test) { - $this->testEnded($test->getName()); - } - - /** - * Returns the loader to be used. - * - * @return PHPUnit2_Runner_TestSuiteLoader - * @access public - */ - public function getLoader() { - return new PHPUnit2_Runner_StandardTestSuiteLoader; - } - - /** - * Returns the Test corresponding to the given suite. - * This is a template method, subclasses override - * the runFailed() and clearStatus() methods. - * - * @param string $suiteClassName - * @param string $suiteClassFile - * @return PHPUnit2_Framework_Test - * @access public - */ - public function getTest($suiteClassName, $suiteClassFile = '') { - if ($suiteClassFile == $suiteClassName . '.php') { - $suiteClassFile = ''; - } - - try { - $testClass = $this->loadSuiteClass($suiteClassName, $suiteClassFile); - } - - catch (Exception $e) { - $this->runFailed($e->getMessage()); - return NULL; - } - - try { - $suiteMethod = $testClass->getMethod(self::SUITE_METHODNAME); - - if (!$suiteMethod->isStatic()) { - $this->runFailed( - 'suite() method must be static.' - ); - - return NULL; - } - - try { - $test = $suiteMethod->invoke(NULL); - } - - catch (ReflectionException $e) { - $this->runFailed( - sprintf( - "Failed to invoke suite() method.\n%s", - - $e->getMessage() - ) - ); - - return NULL; - } - } - - catch (ReflectionException $e) { - $test = new PHPUnit2_Framework_TestSuite($testClass); - } - - $this->clearStatus(); - - return $test; - } - - /** - * Override to define how to handle a failed loading of - * a test suite. - * - * @param string $message - * @access protected - * @abstract - */ - protected abstract function runFailed($message); - - /** - * Returns the loaded ReflectionClass for a suite name. - * - * @param string $suiteClassName - * @param string $suiteClassFile - * @return ReflectionClass - * @access protected - */ - protected function loadSuiteClass($suiteClassName, $suiteClassFile = '') { - return $this->getLoader()->load($suiteClassName, $suiteClassFile); - } - - /** - * Clears the status message. - * - * @access protected - */ - protected function clearStatus() { - } - - /** - * A test started. - * - * @param string $testName - * @access public - * @abstract - */ - public abstract function testStarted($testName); - - /** - * A test ended. - * - * @param string $testName - * @access public - * @abstract - */ - public abstract function testEnded($testName); - - /** - * A test failed. - * - * @param integer $status - * @param PHPUnit2_Framework_Test $test - * @param PHPUnit2_Framework_AssertionFailedError $e - * @access public - * @abstract - */ - public abstract function testFailed($status, PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Runner/IncludePathTestCollector.php b/buildscripts/PHPUnit2/Runner/IncludePathTestCollector.php deleted file mode 100644 index b84f0e74..00000000 --- a/buildscripts/PHPUnit2/Runner/IncludePathTestCollector.php +++ /dev/null @@ -1,184 +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: IncludePathTestCollector.php,v 1.13.2.5 2005/12/17 16:04:56 sebastian Exp $ - * @link http://pear.php.net/package/PHPUnit2 - * @since File available since Release 2.1.0 - */ - -if (!class_exists('AppendIterator')) { - class AppendIterator implements Iterator { - private $iterators; - - public function __construct() { - $this->iterators = new ArrayIterator(); - } - - public function __call($func, $params) { - return call_user_func_array(array($this->getInnerIterator(), $func), $params); - } - - public function append(Iterator $it) { - $this->iterators->append($it); - } - - public function getInnerIterator() { - return $this->iterators->current(); - } - - public function rewind() { - $this->iterators->rewind(); - - if ($this->iterators->valid()) { - $this->getInnerIterator()->rewind(); - } - } - - public function valid() { - return $this->iterators->valid() && $this->getInnerIterator()->valid(); - } - - public function current() { - return $this->iterators->valid() ? $this->getInnerIterator()->current() : NULL; - } - - public function key() { - return $this->iterators->valid() ? $this->getInnerIterator()->key() : NULL; - } - - public function next() { - if (!$this->iterators->valid()) return; - $this->getInnerIterator()->next(); - - if ($this->getInnerIterator()->valid()) return; - $this->iterators->next(); - - while ($this->iterators->valid()) { - $this->getInnerIterator()->rewind(); - - if ($this->getInnerIterator()->valid()) return; - $this->iterators->next(); - } - } - } -} - -require_once 'PHPUnit2/Runner/TestCollector.php'; - -require_once 'PEAR/Config.php'; - -/** - * An implementation of a TestCollector that consults the - * include path set in the php.ini. - * - * @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_Runner_IncludePathTestCollector implements PHPUnit2_Runner_TestCollector { - /** - * @return array - * @access public - */ - public function collectTests() { - $config = new PEAR_Config; - $iterator = new AppendIterator; - $result = array(); - - if (substr(PHP_OS, 0, 3) == 'WIN') { - $delimiter = ';'; - } else { - $delimiter = ':'; - } - - $paths = explode($delimiter, ini_get('include_path')); - $paths[] = $config->get('test_dir'); - - foreach ($paths as $path) { - $iterator->append( - new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($path) - ) - ); - } - - foreach ($iterator as $path => $file) { - if ($this->isTestClass($file)) { - if (substr(PHP_OS, 0, 3) == 'WIN') { - $path = str_replace('/', '\\', $path); - } - - $result[] = $path; - } - } - - return $result; - } - - /** - * Considers a file to contain a test class when it contains the - * pattern "Test" in its name and its name ends with ".php". - * - * @param string $classFileName - * @return boolean - * @access protected - */ - protected function isTestClass($classFileName) { - return (strpos($classFileName, 'Test') !== FALSE && substr($classFileName, -4) == '.php') ? TRUE : FALSE; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Runner/StandardTestSuiteLoader.php b/buildscripts/PHPUnit2/Runner/StandardTestSuiteLoader.php deleted file mode 100644 index e7fccfda..00000000 --- a/buildscripts/PHPUnit2/Runner/StandardTestSuiteLoader.php +++ /dev/null @@ -1,129 +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: StandardTestSuiteLoader.php,v 1.19.2.8 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/Runner/TestSuiteLoader.php'; -require_once 'PHPUnit2/Util/Fileloader.php'; - -require_once 'PEAR/Config.php'; - -/** - * The standard test suite loader. - * - * @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_Runner_StandardTestSuiteLoader implements PHPUnit2_Runner_TestSuiteLoader { - /** - * @param string $suiteClassName - * @param string $suiteClassFile - * @return ReflectionClass - * @throws Exception - * @access public - */ - public function load($suiteClassName, $suiteClassFile = '') { - $suiteClassName = str_replace('.php', '', $suiteClassName); - $suiteClassFile = !empty($suiteClassFile) ? $suiteClassFile : str_replace('_', '/', $suiteClassName) . '.php'; - - if (!class_exists($suiteClassName)) { - if(!file_exists($suiteClassFile)) { - $config = new PEAR_Config; - - $includePaths = explode(PATH_SEPARATOR, get_include_path()); - $includePaths[] = $config->get('test_dir'); - - foreach ($includePaths as $includePath) { - $file = $includePath . DIRECTORY_SEPARATOR . $suiteClassFile; - - if (file_exists($file)) { - $suiteClassFile = $file; - break; - } - } - } - - PHPUnit2_Util_Fileloader::checkAndLoad($suiteClassFile); - } - - if (class_exists($suiteClassName)) { - return new ReflectionClass($suiteClassName); - } else { - throw new Exception( - sprintf( - 'Class %s could not be found in %s.', - - $suiteClassName, - $suiteClassFile - ) - ); - } - } - - /** - * @param ReflectionClass $aClass - * @return ReflectionClass - * @access public - */ - public function reload(ReflectionClass $aClass) { - return $aClass; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Runner/TestCollector.php b/buildscripts/PHPUnit2/Runner/TestCollector.php deleted file mode 100644 index 9c77e6da..00000000 --- a/buildscripts/PHPUnit2/Runner/TestCollector.php +++ /dev/null @@ -1,77 +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: TestCollector.php,v 1.7.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 - */ - -/** - * Collects Test class names to be presented - * by the TestSelector. - * - * @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_Runner_TestCollector { - /** - * @return array - * @access public - */ - public function collectTests(); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Runner/TestSuiteLoader.php b/buildscripts/PHPUnit2/Runner/TestSuiteLoader.php deleted file mode 100644 index 99b91a06..00000000 --- a/buildscripts/PHPUnit2/Runner/TestSuiteLoader.php +++ /dev/null @@ -1,85 +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: TestSuiteLoader.php,v 1.11.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 - */ - -/** - * An interface to define how a test suite should be loaded. - * - * @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_Runner_TestSuiteLoader { - /** - * @param string $suiteClassName - * @param string $suiteClassFile - * @return ReflectionClass - * @access public - */ - public function load($suiteClassName, $suiteClassFile = ''); - - /** - * @param ReflectionClass $aClass - * @return ReflectionClass - * @access public - */ - public function reload(ReflectionClass $aClass); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Runner/Version.php b/buildscripts/PHPUnit2/Runner/Version.php deleted file mode 100644 index 49222c98..00000000 --- a/buildscripts/PHPUnit2/Runner/Version.php +++ /dev/null @@ -1,90 +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: Version.php,v 1.7.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 - */ - -/** - * This class defines the current version of PHPUnit. - * - * @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_Runner_Version { - /** - * Returns the current version of PHPUnit. - * - * @return string - * @access public - * @static - */ - public static function id() { - return '@package_version@'; - } - - /** - * @return string - * @access public - * @static - */ - public static function getVersionString() { - return 'PHPUnit @package_version@ by Sebastian Bergmann.'; - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/TextUI/ResultPrinter.php b/buildscripts/PHPUnit2/TextUI/ResultPrinter.php deleted file mode 100644 index d441e92c..00000000 --- a/buildscripts/PHPUnit2/TextUI/ResultPrinter.php +++ /dev/null @@ -1,356 +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: ResultPrinter.php,v 1.20.2.5 2005/12/17 16:04:57 sebastian Exp $ - * @link http://pear.php.net/package/PHPUnit2 - * @since File available since Release 2.0.0 - */ - -require_once 'PHPUnit2/Framework/TestListener.php'; -require_once 'PHPUnit2/Framework/TestFailure.php'; -require_once 'PHPUnit2/Util/Filter.php'; -require_once 'PHPUnit2/Util/Printer.php'; - -/** - * Prints the result of a TextUI TestRunner run. - * - * @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_TextUI_ResultPrinter extends PHPUnit2_Util_Printer implements PHPUnit2_Framework_TestListener { - /** - * @var integer - * @access private - */ - private $column = 0; - - /** - * @var boolean - * @access private - */ - private $lastTestFailed = FALSE; - - /** - * @param PHPUnit2_Framework_TestResult $result - * @param float $runTime - * @access public - */ - public function printResult(PHPUnit2_Framework_TestResult $result, $timeElapsed) { - $this->printHeader($timeElapsed); - $this->printErrors($result); - $this->printFailures($result); - $this->printIncompletes($result); - $this->printFooter($result); - } - - /** - * @param array $defects - * @param integer $count - * @param string $type - * @access protected - */ - protected function printDefects($defects, $count, $type) { - if ($count == 0) { - return; - } - - $this->write( - sprintf( - "There %s %d %s%s:\n", - - ($count == 1) ? 'was' : 'were', - $count, - $type, - ($count == 1) ? '' : 's' - ) - ); - - $i = 1; - - foreach ($defects as $defect) { - $this->printDefect($defect, $i++); - } - } - - /** - * @param PHPUnit2_Framework_TestFailure $defect - * @param integer $count - * @access protected - */ - protected function printDefect(PHPUnit2_Framework_TestFailure $defect, $count) { - $this->printDefectHeader($defect, $count); - $this->printDefectTrace($defect); - } - - /** - * @param PHPUnit2_Framework_TestFailure $defect - * @param integer $count - * @access protected - */ - protected function printDefectHeader(PHPUnit2_Framework_TestFailure $defect, $count) { - $this->write( - sprintf( - "%d) %s\n", - - $count, - $defect->failedTest()->toString() - ) - ); - } - - /** - * @param PHPUnit2_Framework_TestFailure $defect - * @access protected - */ - protected function printDefectTrace(PHPUnit2_Framework_TestFailure $defect) { - $e = $defect->thrownException(); - $message = method_exists($e, 'toString') ? $e->toString() : $e->getMessage(); - - $this->write($message . "\n"); - - $this->write( - PHPUnit2_Util_Filter::getFilteredStacktrace( - $defect->thrownException() - ) - ); - } - - /** - * @param PHPUnit2_Framework_TestResult $result - * @access protected - */ - protected function printErrors(PHPUnit2_Framework_TestResult $result) { - $this->printDefects($result->errors(), $result->errorCount(), 'error'); - } - - /** - * @param PHPUnit2_Framework_TestResult $result - * @access protected - */ - protected function printFailures(PHPUnit2_Framework_TestResult $result) { - $this->printDefects($result->failures(), $result->failureCount(), 'failure'); - } - - /** - * @param PHPUnit2_Framework_TestResult $result - * @access protected - */ - protected function printIncompletes(PHPUnit2_Framework_TestResult $result) { - $this->printDefects($result->notImplemented(), $result->notImplementedCount(), 'incomplete test case'); - } - - /** - * @param float $timeElapsed - * @access protected - */ - protected function printHeader($timeElapsed) { - $this->write( - sprintf( - "\n\nTime: %s\n", - - $timeElapsed - ) - ); - } - - /** - * @param PHPUnit2_Framework_TestResult $result - * @access protected - */ - protected function printFooter(PHPUnit2_Framework_TestResult $result) { - if ($result->allCompletlyImplemented() && - $result->wasSuccessful()) { - $this->write( - sprintf( - "\nOK (%d test%s)\n", - - $result->runCount(), - ($result->runCount() == 1) ? '' : 's' - ) - ); - } - - else if (!$result->allCompletlyImplemented() && - $result->wasSuccessful()) { - $this->write( - sprintf( - "\nOK, but incomplete test cases!!!\nTests run: %d, Incomplete Tests: %d.\n", - - $result->runCount(), - $result->notImplementedCount() - ) - ); - } - - else { - $this->write( - sprintf( - "\nFAILURES!!!\nTests run: %d, Failures: %d, Errors: %d, Incomplete Tests: %d.\n", - - $result->runCount(), - $result->failureCount(), - $result->errorCount(), - $result->notImplementedCount() - ) - ); - } - } - - /** - * @access public - */ - public function printWaitPrompt() { - $this->write("\n<RETURN> to continue\n"); - } - - /** - * An error occurred. - * - * @param PHPUnit2_Framework_Test $test - * @param Exception $e - * @access public - */ - public function addError(PHPUnit2_Framework_Test $test, Exception $e) { - $this->write('E'); - $this->nextColumn(); - - $this->lastTestFailed = 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->write('F'); - $this->nextColumn(); - - $this->lastTestFailed = TRUE; - } - - /** - * Incomplete test. - * - * @param PHPUnit2_Framework_Test $test - * @param Exception $e - * @access public - */ - public function addIncompleteTest(PHPUnit2_Framework_Test $test, Exception $e) { - $this->write('I'); - $this->nextColumn(); - - $this->lastTestFailed = 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) { - } - - /** - * A test ended. - * - * @param PHPUnit2_Framework_Test $test - * @access public - */ - public function endTest(PHPUnit2_Framework_Test $test) { - if (!$this->lastTestFailed) { - $this->write('.'); - $this->nextColumn(); - } - - $this->lastTestFailed = FALSE; - } - - /** - * @access protected - */ - protected function nextColumn() { - if ($this->column++ >= 40) { - $this->column = 0; - $this->write("\n"); - } - } -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/TextUI/TestRunner.php b/buildscripts/PHPUnit2/TextUI/TestRunner.php deleted file mode 100644 index b21cfca4..00000000 --- a/buildscripts/PHPUnit2/TextUI/TestRunner.php +++ /dev/null @@ -1,622 +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: TestRunner.php,v 1.64.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 - */ - -if (!defined('PHPUnit2_MAIN_METHOD')) { - define('PHPUnit2_MAIN_METHOD', 'PHPUnit2_TextUI_TestRunner::main'); -} - -require_once 'PHPUnit2/Framework/TestSuite.php'; -require_once 'PHPUnit2/Runner/Version.php'; -require_once 'PHPUnit2/Runner/BaseTestRunner.php'; -require_once 'PHPUnit2/TextUI/ResultPrinter.php'; -require_once 'PHPUnit2/Util/Fileloader.php'; - -require_once 'Console/Getopt.php'; -require_once 'Benchmark/Timer.php'; - -/** - * A TestRunner for the Command Line Interface (CLI) - * PHP SAPI Module. - * - * @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_TextUI_TestRunner extends PHPUnit2_Runner_BaseTestRunner { - const SUCCESS_EXIT = 0; - const FAILURE_EXIT = 1; - const EXCEPTION_EXIT = 2; - - /** - * @var PHPUnit2_Runner_TestSuiteLoader - * @access private - */ - private $loader = NULL; - - /** - * @var PHPUnit2_TextUI_ResultPrinter - * @access private - */ - private $printer = NULL; - - /** - * @var boolean - * @access private - * @static - */ - private static $versionStringPrinted = FALSE; - - /** - * @access public - * @static - */ - public static function main() { - $aTestRunner = new PHPUnit2_TextUI_TestRunner; - - try { - $result = $aTestRunner->start($_SERVER['argv']); - - if (!$result->wasSuccessful()) { - exit(self::FAILURE_EXIT); - } - - exit(self::SUCCESS_EXIT); - } - - catch (Exception $e) { - self::printVersionString(); - print $e->getMessage(); - exit(self::EXCEPTION_EXIT); - } - } - - /** - * @param array $arguments - * @throws Exception - * @access protected - */ - protected function start($arguments) { - $coverageDataFile = FALSE; - $coverageHTMLFile = FALSE; - $coverageTextFile = FALSE; - $testdoxHTMLFile = FALSE; - $testdoxTextFile = FALSE; - $xmlLogfile = FALSE; - $wait = FALSE; - - $possibleOptions = array( - 'help', - 'loader=', - 'log-xml=', - 'skeleton', - 'testdox-html=', - 'testdox-text=', - 'version', - 'wait' - ); - - if (extension_loaded('xdebug')) { - $possibleOptions[] = 'coverage-data='; - $possibleOptions[] = 'coverage-html='; - $possibleOptions[] = 'coverage-text='; - } - - $options = Console_Getopt::getopt( - $arguments, - '', - $possibleOptions - ); - - if (PEAR::isError($options)) { - $this->showError($options->getMessage()); - } - - $test = isset($options[1][0]) ? $options[1][0] : FALSE; - $testFile = isset($options[1][1]) ? $options[1][1] : $test . '.php'; - - foreach ($options[0] as $option) { - switch ($option[0]) { - case '--coverage-data': { - $coverageDataFile = $option[1]; - } - break; - - case '--coverage-html': { - $coverageHTMLFile = $option[1]; - } - break; - - case '--coverage-text': { - $coverageTextFile = $option[1]; - } - break; - - case '--help': { - $this->showHelp(); - exit(self::SUCCESS_EXIT); - } - break; - - case '--testdox-html': { - $testdoxHTMLFile = $option[1]; - } - break; - - case '--testdox-text': { - $testdoxTextFile = $option[1]; - } - break; - - case '--loader': { - if (!class_exists($option[1])) { - PHPUnit2_Util_Fileloader::checkAndLoad( - str_replace('_', '/', $option[1]) . '.php' - ); - } - - if (class_exists($option[1])) { - $class = new ReflectionClass($option[1]); - - if ($class->implementsInterface('PHPUnit2_Runner_TestSuiteLoader') && - $class->isInstantiable()) { - $this->loader = $class->newInstance(); - } - } - - if ($this->loader === NULL) { - $this->showError( - sprintf( - 'Could not use "%s" as loader.', - - $option[1] - ) - ); - } - } - break; - - case '--log-xml': { - $xmlLogfile = $option[1]; - } - break; - - case '--skeleton': { - if ($test !== FALSE) { - self::printVersionString(); - - try { - require_once 'PHPUnit2/Util/Skeleton.php'; - - $skeleton = new PHPUnit2_Util_Skeleton($test, $testFile); - $skeleton->write(); - } - - catch (Exception $e) { - print $e->getMessage() . "\n"; - - printf( - "Could not write test class skeleton for %s to %s.\n", - $test, - $test . 'Test.php' - ); - - exit(self::FAILURE_EXIT); - } - - printf( - "Wrote test class skeleton for %s to %s.\n", - $test, - $test . 'Test.php' - ); - - exit(self::SUCCESS_EXIT); - } - } - break; - - case '--version': { - self::printVersionString(); - exit(self::SUCCESS_EXIT); - } - break; - - case '--wait': { - $wait = TRUE; - } - break; - } - } - - if ($test === FALSE) { - $this->showHelp(); - - exit(self::SUCCESS_EXIT); - } - - try { - return $this->doRun( - $this->getTest($test, $testFile), - $coverageDataFile, - $coverageHTMLFile, - $coverageTextFile, - $testdoxHTMLFile, - $testdoxTextFile, - $xmlLogfile, - $wait - ); - } - - catch (Exception $e) { - throw new Exception( - 'Could not create and run test suite: ' . $e->getMessage() - ); - } - } - - /** - * @param mixed $test - * @param mixed $coverageDataFile - * @param mixed $testdoxHTMLFile - * @param mixed $testdoxTextFile - * @param mixed $xmlLogfile - * @param boolean $wait - * @access public - * @static - */ - public static function run($test, $coverageDataFile = FALSE, $coverageHTMLFile = FALSE, $coverageTextFile = FALSE, $testdoxHTMLFile = FALSE, $testdoxTextFile = FALSE, $xmlLogfile = FALSE, $wait = FALSE) { - if ($test instanceof ReflectionClass) { - $test = new PHPUnit2_Framework_TestSuite($test); - } - - if ($test instanceof PHPUnit2_Framework_Test) { - $aTestRunner = new PHPUnit2_TextUI_TestRunner; - - return $aTestRunner->doRun( - $test, - $coverageDataFile, - $coverageHTMLFile, - $coverageTextFile, - $testdoxHTMLFile, - $testdoxTextFile, - $xmlLogfile, - $wait - ); - } - } - - /** - * Runs a single test and waits until the user types RETURN. - * - * @param PHPUnit2_Framework_Test $suite - * @access public - * @static - */ - public static function runAndWait(PHPUnit2_Framework_Test $suite) { - $aTestRunner = new PHPUnit2_TextUI_TestRunner; - - $aTestRunner->doRun( - $suite, - FALSE, - FALSE, - FALSE, - FALSE, - FALSE, - FALSE, - TRUE - ); - } - - /** - * @return PHPUnit2_Framework_TestResult - * @access protected - */ - protected function createTestResult() { - return new PHPUnit2_Framework_TestResult; - } - - /** - * @param PHPUnit2_Framework_Test $suite - * @param mixed $coverageDataFile - * @param mixed $coverageHTMLFile - * @param mixed $coverageTextFile - * @param mixed $testdoxHTMLFile - * @param mixed $testdoxTextFile - * @param mixed $xmlLogfile - * @param boolean $wait - * @return PHPUnit2_Framework_TestResult - * @access public - */ - public function doRun(PHPUnit2_Framework_Test $suite, $coverageDataFile = FALSE, $coverageHTMLFile = FALSE, $coverageTextFile = FALSE, $testdoxHTMLFile = FALSE, $testdoxTextFile = FALSE, $xmlLogfile = FALSE, $wait = FALSE) { - $result = $this->createTestResult(); - $timer = new Benchmark_Timer; - - if ($this->printer === NULL) { - $this->printer = new PHPUnit2_TextUI_ResultPrinter; - } - - $this->printer->write( - PHPUnit2_Runner_Version::getVersionString() . "\n\n" - ); - - $result->addListener($this->printer); - - if ($testdoxHTMLFile !== FALSE || $testdoxTextFile !== FALSE) { - require_once 'PHPUnit2/Util/TestDox/ResultPrinter.php'; - - if ($testdoxHTMLFile !== FALSE) { - $result->addListener( - PHPUnit2_Util_TestDox_ResultPrinter::factory( - 'HTML', - $testdoxHTMLFile - ) - ); - } - - if ($testdoxTextFile !== FALSE) { - $result->addListener( - PHPUnit2_Util_TestDox_ResultPrinter::factory( - 'Text', - $testdoxTextFile - ) - ); - } - } - - if ($xmlLogfile !== FALSE) { - require_once 'PHPUnit2/Util/Log/XML.php'; - - $result->addListener( - new PHPUnit2_Util_Log_XML($xmlLogfile) - ); - } - - if ($coverageDataFile !== FALSE || - $coverageHTMLFile !== FALSE || - $coverageTextFile !== FALSE) { - $result->collectCodeCoverageInformation(TRUE); - } - - $timer->start(); - $suite->run($result); - $timer->stop(); - $timeElapsed = $timer->timeElapsed(); - - $this->pause($wait); - - $this->printer->printResult($result, $timeElapsed); - - $this->handleCodeCoverageInformation( - $result, - $coverageDataFile, - $coverageHTMLFile, - $coverageTextFile - ); - - return $result; - } - - /** - * Returns the loader to be used. - * - * @return PHPUnit2_Runner_TestSuiteLoader - * @access public - * @since Method available since Release 2.2.0 - */ - public function getLoader() { - if ($this->loader === NULL) { - $this->loader = new PHPUnit2_Runner_StandardTestSuiteLoader; - } - - return $this->loader; - } - - /** - * @param PHPUnit2_Framework_TestResult $result - * @param mixed $coverageDataFile - * @param mixed $coverageHTMLFile - * @param mixed $coverageTextFile - * @access protected - * @since Method available since Release 2.1.0 - */ - protected function handleCodeCoverageInformation(PHPUnit2_Framework_TestResult $result, $coverageDataFile, $coverageHTMLFile, $coverageTextFile) { - if ($coverageDataFile !== FALSE && - $fp = fopen($coverageDataFile, 'w')) { - fputs($fp, serialize($result->getCodeCoverageInformation())); - fclose($fp); - } - - if ($coverageHTMLFile !== FALSE || $coverageTextFile !== FALSE) { - require_once 'PHPUnit2/Util/CodeCoverage/Renderer.php'; - - if ($coverageHTMLFile !== FALSE) { - $renderer = PHPUnit2_Util_CodeCoverage_Renderer::factory( - 'HTML', - $result->getCodeCoverageInformation() - ); - - $renderer->renderToFile($coverageHTMLFile); - } - - if ($coverageTextFile !== FALSE) { - $renderer = PHPUnit2_Util_CodeCoverage_Renderer::factory( - 'Text', - $result->getCodeCoverageInformation() - ); - - $renderer->renderToFile($coverageTextFile); - } - } - } - - /** - * @access public - */ - public function showError($message) { - self::printVersionString(); - print $message . "\n"; - - exit(self::FAILURE_EXIT); - } - - /** - * @access public - */ - public function showHelp() { - self::printVersionString(); - print "Usage: phpunit [switches] UnitTest [UnitTest.php]\n"; - - if (extension_loaded('xdebug')) { - print " --coverage-data <file> Write Code Coverage data in raw format to file.\n" . - " --coverage-html <file> Write Code Coverage data in HTML format to file.\n" . - " --coverage-text <file> Write Code Coverage data in text format to file.\n\n"; - } - - print " --testdox-html <file> Write agile documentation in HTML format to file.\n" . - " --testdox-text <file> Write agile documentation in Text format to file.\n" . - " --log-xml <file> Log test progress in XML format to file.\n\n"; - - print " --loader <loader> TestSuiteLoader implementation to use.\n\n" . - " --skeleton Generate skeleton UnitTest class for Unit in Unit.php.\n\n" . - " --wait Waits for a keystroke after each test.\n\n" . - " --help Prints this usage information.\n" . - " --version Prints the version and exits.\n"; - } - - /** - * @param boolean $wait - * @access protected - */ - protected function pause($wait) { - if (!$wait) { - return; - } - - $this->printer->printWaitPrompt(); - - fgets(STDIN); - } - - /** - * @param PHPUnit2_TextUI_ResultPrinter $resultPrinter - * @access public - */ - public function setPrinter(PHPUnit2_TextUI_ResultPrinter $resultPrinter) { - $this->printer = $resultPrinter; - } - - /** - * A test started. - * - * @param string $testName - * @access public - */ - public function testStarted($testName) { - } - - /** - * A test ended. - * - * @param string $testName - * @access public - */ - public function testEnded($testName) { - } - - /** - * A test failed. - * - * @param integer $status - * @param PHPUnit2_Framework_Test $test - * @param PHPUnit2_Framework_AssertionFailedError $e - * @access public - */ - public function testFailed($status, PHPUnit2_Framework_Test $test, PHPUnit2_Framework_AssertionFailedError $e) { - } - - /** - * Override to define how to handle a failed loading of - * a test suite. - * - * @param string $message - * @access protected - */ - protected function runFailed($message) { - self::printVersionString(); - print $message; - exit(self::FAILURE_EXIT); - } - - /** - * @access private - * @since Method available since Release 2.2.0 - */ - private static function printVersionString() { - if (!self::$versionStringPrinted) { - print PHPUnit2_Runner_Version::getVersionString() . "\n\n"; - self::$versionStringPrinted = TRUE; - } - } -} - -if (PHPUnit2_MAIN_METHOD == 'PHPUnit2_TextUI_TestRunner::main') { - PHPUnit2_TextUI_TestRunner::main(); -} - -/* - * Local variables: - * tab-width: 4 - * c-basic-offset: 4 - * c-hanging-comment-ender-p: nil - * End: - */ -?> diff --git a/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer.php b/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer.php deleted file mode 100644 index 408b6850..00000000 --- a/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer.php +++ /dev/null @@ -1,225 +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: 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 deleted file mode 100644 index 128204dc..00000000 --- a/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/HTML.php +++ /dev/null @@ -1,191 +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: 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 deleted file mode 100644 index 92f3282e..00000000 --- a/buildscripts/PHPUnit2/Util/CodeCoverage/Renderer/Text.php +++ /dev/null @@ -1,125 +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: 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 deleted file mode 100644 index 450b2dd2..00000000 --- a/buildscripts/PHPUnit2/Util/ErrorHandler.php +++ /dev/null @@ -1,77 +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: 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 deleted file mode 100644 index 0eb45f82..00000000 --- a/buildscripts/PHPUnit2/Util/Fileloader.php +++ /dev/null @@ -1,109 +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: 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 deleted file mode 100644 index c3138889..00000000 --- a/buildscripts/PHPUnit2/Util/Filter.php +++ /dev/null @@ -1,263 +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: 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 deleted file mode 100644 index 822b34c4..00000000 --- a/buildscripts/PHPUnit2/Util/Log/PEAR.php +++ /dev/null @@ -1,220 +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: 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 deleted file mode 100644 index dba4c929..00000000 --- a/buildscripts/PHPUnit2/Util/Log/XML.php +++ /dev/null @@ -1,356 +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: 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 deleted file mode 100644 index 2134f9b8..00000000 --- a/buildscripts/PHPUnit2/Util/Printer.php +++ /dev/null @@ -1,116 +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: 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 deleted file mode 100644 index 4f2d0770..00000000 --- a/buildscripts/PHPUnit2/Util/Skeleton.php +++ /dev/null @@ -1,340 +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: 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 deleted file mode 100644 index b4787a7f..00000000 --- a/buildscripts/PHPUnit2/Util/TestDox/NamePrettifier.php +++ /dev/null @@ -1,165 +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: 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 deleted file mode 100644 index 5b47ef42..00000000 --- a/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter.php +++ /dev/null @@ -1,299 +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: 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 deleted file mode 100644 index 2eda325a..00000000 --- a/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/HTML.php +++ /dev/null @@ -1,120 +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: 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 deleted file mode 100644 index 388dab50..00000000 --- a/buildscripts/PHPUnit2/Util/TestDox/ResultPrinter/Text.php +++ /dev/null @@ -1,102 +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: 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: - */ -?> diff --git a/buildscripts/PHPUnit2/pear-phpunit b/buildscripts/PHPUnit2/pear-phpunit deleted file mode 100644 index 25e8944d..00000000 --- a/buildscripts/PHPUnit2/pear-phpunit +++ /dev/null @@ -1,41 +0,0 @@ -#!@php_bin@
-<?php
-/* 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.
- *
- * $Id: pear-phpunit,v 1.2.8.2 2005/12/17 16:04:56 sebastian Exp $
- */
-
-require 'PHPUnit2/TextUI/TestRunner.php';
-?>
diff --git a/buildscripts/PHPUnit2/pear-phpunit.bat b/buildscripts/PHPUnit2/pear-phpunit.bat deleted file mode 100644 index d7aadb5c..00000000 --- a/buildscripts/PHPUnit2/pear-phpunit.bat +++ /dev/null @@ -1,39 +0,0 @@ -@echo off
-REM PHP Version 5
-REM
-REM Copyright (c) 2002-2006, Sebastian Bergmann <sb@sebastian-bergmann.de>.
-REM All rights reserved.
-REM
-REM Redistribution and use in source and binary forms, with or without
-REM modification, are permitted provided that the following conditions
-REM are met:
-REM
-REM * Redistributions of source code must retain the above copyright
-REM notice, this list of conditions and the following disclaimer.
-REM
-REM * Redistributions in binary form must reproduce the above copyright
-REM notice, this list of conditions and the following disclaimer in
-REM the documentation and/or other materials provided with the
-REM distribution.
-REM
-REM * Neither the name of Sebastian Bergmann nor the names of his
-REM contributors may be used to endorse or promote products derived
-REM from this software without specific prior written permission.
-REM
-REM THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-REM "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-REM LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-REM FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-REM COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-REM INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-REM BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-REM LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-REM CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRIC
-REM LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
-REM ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-REM POSSIBILITY OF SUCH DAMAGE.
-REM
-REM $Id: pear-phpunit.bat,v 1.3.2.2 2005/12/17 16:04:56 sebastian Exp $
-REM
-
-"@php_bin@" "@php_dir@/PHPUnit2/TextUI/TestRunner.php" %*
|