cvs: pear(ZEND_ENGINE_2) /PHPUnit AssertionFailedError.php ExceptionTestCase.php TestCase.php TestFailure.php TestListener.php TestResult.php
TestRunner.php /PHPUnit/TestRunner CLI.php
| From: | Sebastian Bergmann | Date: | Sun, 23 Mar 2003 16:05:38 +0000 |
| Subject: | cvs: pear(ZEND_ENGINE_2) /PHPUnit AssertionFailedError.php ExceptionTestCase.php TestCase.php TestFailure.php TestListener.php TestResult.php TestRunner.php /PHPUnit/TestRunner CLI.php |
||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-9581@lists.php.net to get a copy of this message | ||
sebastian Sun Mar 23 11:05:38 2003 EDT
Modified files: (Branch: ZEND_ENGINE_2)
/pear/PHPUnit AssertionFailedError.php ExceptionTestCase.php
TestCase.php TestFailure.php TestListener.php
TestResult.php TestRunner.php
/pear/PHPUnit/TestRunner CLI.php
Log:
-Throwable+Exception
Index: pear/PHPUnit/AssertionFailedError.php diff -u pear/PHPUnit/AssertionFailedError.php:1.1.2.2 pear/PHPUnit/AssertionFailedError.php:1.1.2.3 --- pear/PHPUnit/AssertionFailedError.php:1.1.2.2 Fri Mar 21 08:22:29 2003 +++ pear/PHPUnit/AssertionFailedError.php Sun Mar 23 11:05:38 2003 @@ -12,14 +12,10 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: AssertionFailedError.php,v 1.1.2.2 2003/03/21 13:22:29 sebastian Exp $ +// $Id: AssertionFailedError.php,v 1.1.2.3 2003/03/23 16:05:38 sebastian Exp $ // namespace PEAR:PHPUnit { - // XXX: FIX ME: Workaround until PHP provides a built-in - // Throwable interface. - interface Throwable {} - /** * Thrown when an assertion failed. * @@ -27,7 +23,7 @@ * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * Based upon JUnit, see http://www.junit.org/ for details. */ - class AssertionFailedError implements Throwable { + class AssertionFailedError extends ::Exception { // {{{ Members /** Index: pear/PHPUnit/ExceptionTestCase.php diff -u pear/PHPUnit/ExceptionTestCase.php:1.1.2.1 pear/PHPUnit/ExceptionTestCase.php:1.1.2.2 --- pear/PHPUnit/ExceptionTestCase.php:1.1.2.1 Mon Mar 10 05:52:21 2003 +++ pear/PHPUnit/ExceptionTestCase.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: ExceptionTestCase.php,v 1.1.2.1 2003/03/10 10:52:21 sebastian Exp $ +// $Id: ExceptionTestCase.php,v 1.1.2.2 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/TestCase.php'; @@ -61,13 +61,13 @@ parent::runTest(); } - catch (Throwable $t) { - if ($t instanceof $this->fExpected) { + catch (Exception $e) { + if ($e instanceof $this->fExpected) { return; } else { - throw $t; + throw $e; } - } + } $this->fail('Expected exception ' . $this->fExpected); } Index: pear/PHPUnit/TestCase.php diff -u pear/PHPUnit/TestCase.php:1.1.2.3 pear/PHPUnit/TestCase.php:1.1.2.4 --- pear/PHPUnit/TestCase.php:1.1.2.3 Fri Mar 21 08:14:23 2003 +++ pear/PHPUnit/TestCase.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestCase.php,v 1.1.2.3 2003/03/21 13:14:23 sebastian Exp $ +// $Id: TestCase.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/Assert.php'; @@ -154,11 +154,11 @@ } catch (AssertionFailedError $e) { - $this->result->addFailure($this, $t); + $this->result->addFailure($this, $e); } - catch (Throwable $t) { - $this->result->addError($this, $t); + catch (Exception $e) { + $this->result->addError($this, $e); } $this->tearDown(); Index: pear/PHPUnit/TestFailure.php diff -u pear/PHPUnit/TestFailure.php:1.1.2.3 pear/PHPUnit/TestFailure.php:1.1.2.4 --- pear/PHPUnit/TestFailure.php:1.1.2.3 Sun Mar 9 05:41:47 2003 +++ pear/PHPUnit/TestFailure.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestFailure.php,v 1.1.2.3 2003/03/09 10:41:47 sebastian Exp $ +// $Id: TestFailure.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/Test.php'; @@ -41,16 +41,16 @@ private $thrownException; // }}} - // {{{ public function __construct(Test $failedTest, Throwable $thrownException) + // {{{ public function __construct(Test $failedTest, Exception $thrownException) /** * Constructs a TestFailure with the given test and exception. * * @param Test $failedTest - * @param Throwable $thrownException + * @param Exception $thrownException * @access public */ - public function __construct(Test $failedTest, Throwable $thrownException) { + public function __construct(Test $failedTest, Exception $thrownException) { $this->failedTest = $failedTest; $this->thrownException = $thrownException; } @@ -74,7 +74,7 @@ /** * Gets the thrown exception. * - * @return Throwable + * @return Exception * @access public */ public function thrownException() { Index: pear/PHPUnit/TestListener.php diff -u pear/PHPUnit/TestListener.php:1.1.2.3 pear/PHPUnit/TestListener.php:1.1.2.4 --- pear/PHPUnit/TestListener.php:1.1.2.3 Sun Mar 9 05:41:51 2003 +++ pear/PHPUnit/TestListener.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestListener.php,v 1.1.2.3 2003/03/09 10:41:51 sebastian Exp $ +// $Id: TestListener.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; @@ -79,16 +79,16 @@ * Based upon JUnit, see http://www.junit.org/ for details. */ interface TestListener { - // {{{ public function addError(Test $test, Throwable $t) + // {{{ public function addError(Test $test, Exception $e) /** * An error occurred. * * @param Test $test - * @param Throwable $t + * @param Exception $e * @access public */ - public function addError(Test $test, Throwable $t); + public function addError(Test $test, Exception $e); // }}} // {{{ public function addFailure(Test $test, AssertionFailedError $t) Index: pear/PHPUnit/TestResult.php diff -u pear/PHPUnit/TestResult.php:1.1.2.3 pear/PHPUnit/TestResult.php:1.1.2.4 --- pear/PHPUnit/TestResult.php:1.1.2.3 Sun Mar 9 05:41:51 2003 +++ pear/PHPUnit/TestResult.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestResult.php,v 1.1.2.3 2003/03/09 10:41:51 sebastian Exp $ +// $Id: TestResult.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; @@ -68,21 +68,21 @@ private $stop = false; // }}} - // {{{ public function addError(Test $test, Throwable $t) + // {{{ public function addError(Test $test, Exception $e) /** * Adds an error to the list of errors. * The passed in exception caused the error. * * @param Test $test - * @param Throwable $t + * @param Exception $e * @access public */ - public function addError(Test $test, Throwable $t) { - $this->errors[] = new TestFailure($test, $t); + public function addError(Test $test, Exception $e) { + $this->errors[] = new TestFailure($test, $e); for ($i = 0; $i < sizeof($this->listeners); $i++) { - $this->listeners[$i]->addError($test, $t); + $this->listeners[$i]->addError($test, $e); } } Index: pear/PHPUnit/TestRunner.php diff -u pear/PHPUnit/TestRunner.php:1.1.2.5 pear/PHPUnit/TestRunner.php:1.1.2.6 --- pear/PHPUnit/TestRunner.php:1.1.2.5 Sun Mar 9 05:41:51 2003 +++ pear/PHPUnit/TestRunner.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestRunner.php,v 1.1.2.5 2003/03/09 10:41:51 sebastian Exp $ +// $Id: TestRunner.php,v 1.1.2.6 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; @@ -28,17 +28,17 @@ * Based upon JUnit, see http://www.junit.org/ for details. */ abstract class TestRunner implements TestListener { - // {{{ public function addError(Test $test, Throwable $t) + // {{{ public function addError(Test $test, Exception $e) /** * An error occurred. * * @param Test $test - * @param Throwable $t + * @param Exception $e * @access public */ - public function addError(Test $test, Throwable $t) { - $this->testFailed(TestRunListener::STATUS_ERROR, $test, $t); + public function addError(Test $test, Exception $e) { + $this->testFailed(TestRunListener::STATUS_ERROR, $test, $e); } // }}} Index: pear/PHPUnit/TestRunner/CLI.php diff -u pear/PHPUnit/TestRunner/CLI.php:1.1.2.9 pear/PHPUnit/TestRunner/CLI.php:1.1.2.10 --- pear/PHPUnit/TestRunner/CLI.php:1.1.2.9 Sat Mar 22 02:37:59 2003 +++ pear/PHPUnit/TestRunner/CLI.php Sun Mar 23 11:05:38 2003 @@ -12,11 +12,12 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: CLI.php,v 1.1.2.9 2003/03/22 07:37:59 sebastian Exp $ +// $Id: CLI.php,v 1.1.2.10 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; require_once 'PHPUnit/Test.php'; +require_once 'PHPUnit/TestCase.php'; require_once 'PHPUnit/TestResult.php'; require_once 'PHPUnit/TestRunner.php'; require_once 'PHPUnit/Version.php'; @@ -95,7 +96,7 @@ ); if (isset($args[1])) { - @include $args[1] . '.php'; + include $args[1] . '.php'; if (class_exists($args[1])) { $suite = new $args[1];
Index: pear/PHPUnit/AssertionFailedError.php diff -u pear/PHPUnit/AssertionFailedError.php:1.1.2.2 pear/PHPUnit/AssertionFailedError.php:1.1.2.3 --- pear/PHPUnit/AssertionFailedError.php:1.1.2.2 Fri Mar 21 08:22:29 2003 +++ pear/PHPUnit/AssertionFailedError.php Sun Mar 23 11:05:38 2003 @@ -12,14 +12,10 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: AssertionFailedError.php,v 1.1.2.2 2003/03/21 13:22:29 sebastian Exp $ +// $Id: AssertionFailedError.php,v 1.1.2.3 2003/03/23 16:05:38 sebastian Exp $ // namespace PEAR:PHPUnit { - // XXX: FIX ME: Workaround until PHP provides a built-in - // Throwable interface. - interface Throwable {} - /** * Thrown when an assertion failed. * @@ -27,7 +23,7 @@ * @author Sebastian Bergmann <sb@sebastian-bergmann.de> * Based upon JUnit, see http://www.junit.org/ for details. */ - class AssertionFailedError implements Throwable { + class AssertionFailedError extends ::Exception { // {{{ Members /** Index: pear/PHPUnit/ExceptionTestCase.php diff -u pear/PHPUnit/ExceptionTestCase.php:1.1.2.1 pear/PHPUnit/ExceptionTestCase.php:1.1.2.2 --- pear/PHPUnit/ExceptionTestCase.php:1.1.2.1 Mon Mar 10 05:52:21 2003 +++ pear/PHPUnit/ExceptionTestCase.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: ExceptionTestCase.php,v 1.1.2.1 2003/03/10 10:52:21 sebastian Exp $ +// $Id: ExceptionTestCase.php,v 1.1.2.2 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/TestCase.php'; @@ -61,13 +61,13 @@ parent::runTest(); } - catch (Throwable $t) { - if ($t instanceof $this->fExpected) { + catch (Exception $e) { + if ($e instanceof $this->fExpected) { return; } else { - throw $t; + throw $e; } - } + } $this->fail('Expected exception ' . $this->fExpected); } Index: pear/PHPUnit/TestCase.php diff -u pear/PHPUnit/TestCase.php:1.1.2.3 pear/PHPUnit/TestCase.php:1.1.2.4 --- pear/PHPUnit/TestCase.php:1.1.2.3 Fri Mar 21 08:14:23 2003 +++ pear/PHPUnit/TestCase.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestCase.php,v 1.1.2.3 2003/03/21 13:14:23 sebastian Exp $ +// $Id: TestCase.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/Assert.php'; @@ -154,11 +154,11 @@ } catch (AssertionFailedError $e) { - $this->result->addFailure($this, $t); + $this->result->addFailure($this, $e); } - catch (Throwable $t) { - $this->result->addError($this, $t); + catch (Exception $e) { + $this->result->addError($this, $e); } $this->tearDown(); Index: pear/PHPUnit/TestFailure.php diff -u pear/PHPUnit/TestFailure.php:1.1.2.3 pear/PHPUnit/TestFailure.php:1.1.2.4 --- pear/PHPUnit/TestFailure.php:1.1.2.3 Sun Mar 9 05:41:47 2003 +++ pear/PHPUnit/TestFailure.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestFailure.php,v 1.1.2.3 2003/03/09 10:41:47 sebastian Exp $ +// $Id: TestFailure.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/Test.php'; @@ -41,16 +41,16 @@ private $thrownException; // }}} - // {{{ public function __construct(Test $failedTest, Throwable $thrownException) + // {{{ public function __construct(Test $failedTest, Exception $thrownException) /** * Constructs a TestFailure with the given test and exception. * * @param Test $failedTest - * @param Throwable $thrownException + * @param Exception $thrownException * @access public */ - public function __construct(Test $failedTest, Throwable $thrownException) { + public function __construct(Test $failedTest, Exception $thrownException) { $this->failedTest = $failedTest; $this->thrownException = $thrownException; } @@ -74,7 +74,7 @@ /** * Gets the thrown exception. * - * @return Throwable + * @return Exception * @access public */ public function thrownException() { Index: pear/PHPUnit/TestListener.php diff -u pear/PHPUnit/TestListener.php:1.1.2.3 pear/PHPUnit/TestListener.php:1.1.2.4 --- pear/PHPUnit/TestListener.php:1.1.2.3 Sun Mar 9 05:41:51 2003 +++ pear/PHPUnit/TestListener.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestListener.php,v 1.1.2.3 2003/03/09 10:41:51 sebastian Exp $ +// $Id: TestListener.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; @@ -79,16 +79,16 @@ * Based upon JUnit, see http://www.junit.org/ for details. */ interface TestListener { - // {{{ public function addError(Test $test, Throwable $t) + // {{{ public function addError(Test $test, Exception $e) /** * An error occurred. * * @param Test $test - * @param Throwable $t + * @param Exception $e * @access public */ - public function addError(Test $test, Throwable $t); + public function addError(Test $test, Exception $e); // }}} // {{{ public function addFailure(Test $test, AssertionFailedError $t) Index: pear/PHPUnit/TestResult.php diff -u pear/PHPUnit/TestResult.php:1.1.2.3 pear/PHPUnit/TestResult.php:1.1.2.4 --- pear/PHPUnit/TestResult.php:1.1.2.3 Sun Mar 9 05:41:51 2003 +++ pear/PHPUnit/TestResult.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestResult.php,v 1.1.2.3 2003/03/09 10:41:51 sebastian Exp $ +// $Id: TestResult.php,v 1.1.2.4 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; @@ -68,21 +68,21 @@ private $stop = false; // }}} - // {{{ public function addError(Test $test, Throwable $t) + // {{{ public function addError(Test $test, Exception $e) /** * Adds an error to the list of errors. * The passed in exception caused the error. * * @param Test $test - * @param Throwable $t + * @param Exception $e * @access public */ - public function addError(Test $test, Throwable $t) { - $this->errors[] = new TestFailure($test, $t); + public function addError(Test $test, Exception $e) { + $this->errors[] = new TestFailure($test, $e); for ($i = 0; $i < sizeof($this->listeners); $i++) { - $this->listeners[$i]->addError($test, $t); + $this->listeners[$i]->addError($test, $e); } } Index: pear/PHPUnit/TestRunner.php diff -u pear/PHPUnit/TestRunner.php:1.1.2.5 pear/PHPUnit/TestRunner.php:1.1.2.6 --- pear/PHPUnit/TestRunner.php:1.1.2.5 Sun Mar 9 05:41:51 2003 +++ pear/PHPUnit/TestRunner.php Sun Mar 23 11:05:38 2003 @@ -12,7 +12,7 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: TestRunner.php,v 1.1.2.5 2003/03/09 10:41:51 sebastian Exp $ +// $Id: TestRunner.php,v 1.1.2.6 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; @@ -28,17 +28,17 @@ * Based upon JUnit, see http://www.junit.org/ for details. */ abstract class TestRunner implements TestListener { - // {{{ public function addError(Test $test, Throwable $t) + // {{{ public function addError(Test $test, Exception $e) /** * An error occurred. * * @param Test $test - * @param Throwable $t + * @param Exception $e * @access public */ - public function addError(Test $test, Throwable $t) { - $this->testFailed(TestRunListener::STATUS_ERROR, $test, $t); + public function addError(Test $test, Exception $e) { + $this->testFailed(TestRunListener::STATUS_ERROR, $test, $e); } // }}} Index: pear/PHPUnit/TestRunner/CLI.php diff -u pear/PHPUnit/TestRunner/CLI.php:1.1.2.9 pear/PHPUnit/TestRunner/CLI.php:1.1.2.10 --- pear/PHPUnit/TestRunner/CLI.php:1.1.2.9 Sat Mar 22 02:37:59 2003 +++ pear/PHPUnit/TestRunner/CLI.php Sun Mar 23 11:05:38 2003 @@ -12,11 +12,12 @@ // | license@php.net so we can mail you a copy immediately. | // +------------------------------------------------------------------------+ // -// $Id: CLI.php,v 1.1.2.9 2003/03/22 07:37:59 sebastian Exp $ +// $Id: CLI.php,v 1.1.2.10 2003/03/23 16:05:38 sebastian Exp $ // require_once 'PHPUnit/AssertionFailedError.php'; require_once 'PHPUnit/Test.php'; +require_once 'PHPUnit/TestCase.php'; require_once 'PHPUnit/TestResult.php'; require_once 'PHPUnit/TestRunner.php'; require_once 'PHPUnit/Version.php'; @@ -95,7 +96,7 @@ ); if (isset($args[1])) { - @include $args[1] . '.php'; + include $args[1] . '.php'; if (class_exists($args[1])) { $suite = new $args[1];