3 * Base include file for SimpleTest
5 * @subpackage UnitTester
10 * Includes SimpleTest files and defined the root constant
11 * for dependent libraries.
13 require_once(dirname(__FILE__
) . '/errors.php');
14 require_once(dirname(__FILE__
) . '/compatibility.php');
15 require_once(dirname(__FILE__
) . '/scorer.php');
16 require_once(dirname(__FILE__
) . '/expectation.php');
17 require_once(dirname(__FILE__
) . '/dumper.php');
18 if (! defined('SIMPLE_TEST')) {
19 define('SIMPLE_TEST', dirname(__FILE__
) . '/');
24 * This is called by the class runner to run a
25 * single test method. Will also run the setUp()
26 * and tearDown() methods.
28 * @subpackage UnitTester
34 * Stashes the test case for later.
35 * @param SimpleTestCase $test_case Test case to run.
37 function SimpleInvoker(&$test_case) {
38 $this->_test_case
= &$test_case;
42 * Accessor for test case being run.
43 * @return SimpleTestCase Test case.
46 function &getTestCase() {
47 return $this->_test_case
;
51 * Runs test level set up. Used for changing
52 * the mechanics of base test cases.
53 * @param string $method Test method to call.
56 function before($method) {
57 $this->_test_case
->before($method);
61 * Invokes a test method and buffered with setUp()
62 * and tearDown() calls.
63 * @param string $method Test method to call.
66 function invoke($method) {
67 $this->_test_case
->setUp();
68 $this->_test_case
->$method();
69 $this->_test_case
->tearDown();
73 * Runs test level clean up. Used for changing
74 * the mechanics of base test cases.
75 * @param string $method Test method to call.
78 function after($method) {
79 $this->_test_case
->after($method);
84 * Do nothing decorator. Just passes the invocation
87 * @subpackage UnitTester
89 class SimpleInvokerDecorator
{
93 * Stores the invoker to wrap.
94 * @param SimpleInvoker $invoker Test method runner.
96 function SimpleInvokerDecorator(&$invoker) {
97 $this->_invoker
= &$invoker;
101 * Accessor for test case being run.
102 * @return SimpleTestCase Test case.
105 function &getTestCase() {
106 return $this->_invoker
->getTestCase();
110 * Runs test level set up. Used for changing
111 * the mechanics of base test cases.
112 * @param string $method Test method to call.
115 function before($method) {
116 $this->_invoker
->before($method);
120 * Invokes a test method and buffered with setUp()
121 * and tearDown() calls.
122 * @param string $method Test method to call.
125 function invoke($method) {
126 $this->_invoker
->invoke($method);
130 * Runs test level clean up. Used for changing
131 * the mechanics of base test cases.
132 * @param string $method Test method to call.
135 function after($method) {
136 $this->_invoker
->after($method);