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, $focused = false) |
||
31 | |||
32 | /** |
||
33 | * {@inheritdoc} |
||
34 | * |
||
35 | * @return bool |
||
36 | */ |
||
37 | public function isFocused() |
||
41 | |||
42 | /** |
||
43 | * Execute the test along with any setup and tear down functions. |
||
44 | * |
||
45 | * @param TestResult $result |
||
46 | * @return void |
||
47 | */ |
||
48 | public function run(TestResult $result) |
||
59 | |||
60 | /** |
||
61 | * Attempt to execute setup functions and run the test definition |
||
62 | * |
||
63 | * @param TestResult $result |
||
64 | */ |
||
65 | protected function executeTest(TestResult $result) |
||
80 | |||
81 | /** |
||
82 | * Excecute the test's setup functions |
||
83 | */ |
||
84 | protected function runSetup() |
||
93 | |||
94 | /** |
||
95 | * Run the tests tear down methods and have the result |
||
96 | * perform the method indicated by $action |
||
97 | * |
||
98 | * @param TestResult $result |
||
99 | * @param array $action |
||
100 | */ |
||
101 | protected function runTearDown(TestResult $result, array $action) |
||
117 | |||
118 | /** |
||
119 | * Set an error handler to handle errors within the test |
||
120 | * |
||
121 | * @param TestResult $result |
||
122 | * @param array &$action |
||
123 | * |
||
124 | * @return callable|null |
||
125 | */ |
||
126 | protected function handleErrors(TestResult $result, array &$action) |
||
150 | |||
151 | /** |
||
152 | * Restore the previous error handler |
||
153 | * |
||
154 | * @param callable|null $handler |
||
155 | */ |
||
156 | protected function restoreErrorHandler($handler) |
||
165 | |||
166 | /** |
||
167 | * Fail the test, but do not overwrite existing failures |
||
168 | * |
||
169 | * @param array &$action |
||
170 | * @param mixed $error |
||
171 | */ |
||
172 | protected function failIfPassing(array &$action, $error) |
||
178 | } |
||
179 |