2 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
7 * LICENSE: This source file is subject to version 3.0 of the PHP license
8 * that is available through the world-wide-web at the following URI:
9 * http://www.php.net/license/3_0.txt. If you did not receive a copy of
10 * the PHP License and are unable to obtain it through the web, please
11 * send a note to license@php.net so we can mail you a copy immediately.
15 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
16 * @copyright 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
17 * @license http://www.php.net/license/3_0.txt PHP License 3.0
19 * @link http://pear.php.net/package/PHPUnit
20 * @since File available since Release 1.0.0
23 require_once 'PHPUnit/TestCase.php';
24 require_once 'PHPUnit/TestSuite.php';
26 if (!function_exists('is_a')) {
27 require_once 'PHP/Compat/Function/is_a.php';
31 * A Decorator for Tests.
33 * Use TestDecorator as the base class for defining new
34 * test decorators. Test decorator subclasses can be introduced
35 * to add behaviour before or after a test is run.
39 * @author Sebastian Bergmann <sb@sebastian-bergmann.de>
40 * @copyright 2002-2005 Sebastian Bergmann <sb@sebastian-bergmann.de>
41 * @license http://www.php.net/license/3_0.txt PHP License 3.0
42 * @version Release: @package_version@
43 * @link http://pear.php.net/package/PHPUnit
44 * @since Class available since Release 1.0.0
46 class PHPUnit_TestDecorator {
48 * The Test to be decorated.
61 function PHPUnit_TestDecorator(&$test) {
62 if (is_object($test) &&
63 (is_a($test, 'PHPUnit_TestCase') ||
64 is_a($test, 'PHPUnit_TestSuite'))) {
66 $this->_test = &$test;
71 * Runs the test and collects the
72 * result in a TestResult.
77 function basicRun(&$result) {
78 $this->_test->run($result);
82 * Counts the number of test cases that
83 * will be run by this test.
88 function countTestCases() {
89 return $this->_test->countTestCases();
93 * Returns the test to be run.
103 * Runs the decorated test and collects the
104 * result in a TestResult.
110 function run(&$result) { /* abstract */ }
113 * Returns a string representation of the test.
118 function toString() {
119 return $this->_test->toString();
127 * c-hanging-comment-ender-p: nil