1 | <?php |
||
15 | class Test extends AbstractTest |
||
16 | { |
||
17 | /** |
||
18 | * @param string $description |
||
19 | * @param callable $definition |
||
20 | */ |
||
21 | public function __construct($description, callable $definition = null) |
||
31 | |||
32 | /** |
||
33 | * Execute the test along with any setup and tear down functions. |
||
34 | * |
||
35 | * @param TestResult $result |
||
36 | * @return void |
||
37 | */ |
||
38 | public function run(TestResult $result) |
||
49 | |||
50 | /** |
||
51 | * Attempt to execute setup functions and run the test definition |
||
52 | * |
||
53 | * @param TestResult $result |
||
54 | */ |
||
55 | protected function executeTest(TestResult $result) |
||
70 | |||
71 | /** |
||
72 | * Excecute the test's setup functions |
||
73 | */ |
||
74 | protected function runSetup() |
||
83 | |||
84 | /** |
||
85 | * Run the tests tear down methods and have the result |
||
86 | * perform the method indicated by $action |
||
87 | * |
||
88 | * @param TestResult $result |
||
89 | * @param array $action |
||
90 | */ |
||
91 | protected function runTearDown(TestResult $result, array $action) |
||
107 | |||
108 | /** |
||
109 | * Set an error handler to handle errors within the test |
||
110 | * |
||
111 | * @param TestResult $result |
||
112 | * @param array &$action |
||
113 | * |
||
114 | * @return callable|null |
||
115 | */ |
||
116 | protected function handleErrors(TestResult $result, array &$action) |
||
138 | |||
139 | /** |
||
140 | * Restore the previous error handler |
||
141 | * |
||
142 | * @param callable|null $handler |
||
143 | */ |
||
144 | protected function restoreErrorHandler($handler) |
||
153 | |||
154 | /** |
||
155 | * Fail the test, but do not overwrite existing failures |
||
156 | * |
||
157 | * @param array &$action |
||
158 | * @param Exception|Error $error |
||
159 | */ |
||
160 | protected function failIfPassing(array &$action, $error) |
||
166 | } |
||
167 |