1 | <?php |
||
10 | abstract class AbstractTest implements TestInterface |
||
11 | { |
||
12 | use HasEventEmitterTrait; |
||
13 | |||
14 | /** |
||
15 | * The test definition as a callable. |
||
16 | * |
||
17 | * @var callable |
||
18 | */ |
||
19 | protected $definition; |
||
20 | |||
21 | /** |
||
22 | * A collection of functions to run before tests execute. |
||
23 | * |
||
24 | * @var array |
||
25 | */ |
||
26 | protected $setUpFns = []; |
||
27 | |||
28 | /** |
||
29 | * A collection of functions to run after tests execute. |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | protected $tearDownFns = []; |
||
34 | |||
35 | /** |
||
36 | * @var string |
||
37 | */ |
||
38 | protected $description; |
||
39 | |||
40 | /** |
||
41 | * @var TestInterface |
||
42 | */ |
||
43 | protected $parent; |
||
44 | |||
45 | /** |
||
46 | * @var bool|null |
||
47 | */ |
||
48 | protected $pending = null; |
||
49 | |||
50 | /** |
||
51 | * @var bool |
||
52 | */ |
||
53 | protected $focused; |
||
54 | |||
55 | /** |
||
56 | * @var Scope |
||
57 | */ |
||
58 | protected $scope; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $file; |
||
64 | |||
65 | /** |
||
66 | * @var array |
||
67 | */ |
||
68 | protected $definitionArguments = []; |
||
69 | |||
70 | /** |
||
71 | * @param string $description |
||
72 | * @param callable $definition |
||
73 | * @param bool $focused |
||
74 | */ |
||
75 | public function __construct($description, callable $definition, $focused = false) |
||
82 | |||
83 | /** |
||
84 | * {@inheritdoc} |
||
85 | * |
||
86 | * @param callable $setupFn |
||
87 | */ |
||
88 | public function addSetupFunction(callable $setupFn) |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | * |
||
97 | * @param callable $tearDownFn |
||
98 | */ |
||
99 | public function addTearDownFunction(callable $tearDownFn) |
||
104 | |||
105 | /** |
||
106 | * {@inheritdoc} |
||
107 | * |
||
108 | * @return string |
||
109 | */ |
||
110 | public function getDescription() |
||
114 | |||
115 | /** |
||
116 | * {@inheritdoc} |
||
117 | * |
||
118 | * @return callable |
||
119 | */ |
||
120 | public function getDefinition() |
||
124 | |||
125 | /** |
||
126 | * {@inheritdoc} |
||
127 | * |
||
128 | * @param TestInterface $parent |
||
129 | * @return mixed|void |
||
130 | */ |
||
131 | public function setParent(TestInterface $parent) |
||
136 | |||
137 | /** |
||
138 | * {@inheritdoc} |
||
139 | * |
||
140 | * @return TestInterface |
||
141 | */ |
||
142 | public function getParent() |
||
146 | |||
147 | /** |
||
148 | * {@inheritdoc} |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | public function getTitle() |
||
163 | |||
164 | /** |
||
165 | * {@inheritdoc} |
||
166 | * |
||
167 | * @return bool|null |
||
168 | */ |
||
169 | public function getPending() |
||
173 | |||
174 | /** |
||
175 | * {@inheritdoc} |
||
176 | * |
||
177 | * @param bool $state |
||
178 | */ |
||
179 | public function setPending($state) |
||
183 | |||
184 | /** |
||
185 | * Set the focused status of the test and its children according to the |
||
186 | * supplied focus pattern and/or skip pattern |
||
187 | * |
||
188 | * @param string|null $focusPattern |
||
189 | * @param string|null $skipPattern |
||
190 | */ |
||
191 | public function applyFocusPatterns($focusPattern, $skipPattern = null) |
||
207 | |||
208 | /** |
||
209 | * {@inheritdoc} |
||
210 | * |
||
211 | * @return array |
||
212 | */ |
||
213 | public function getSetupFunctions() |
||
217 | |||
218 | /** |
||
219 | * {@inheritdoc} |
||
220 | * |
||
221 | * @return array |
||
222 | */ |
||
223 | public function getTearDownFunctions() |
||
227 | |||
228 | /** |
||
229 | * {@inheritdoc} |
||
230 | * |
||
231 | * @param callable $fn |
||
232 | */ |
||
233 | public function forEachNodeBottomUp(callable $fn) |
||
241 | |||
242 | /** |
||
243 | * {@inheritdoc} |
||
244 | * |
||
245 | * @param callable $fn |
||
246 | */ |
||
247 | public function forEachNodeTopDown(callable $fn) |
||
259 | |||
260 | /** |
||
261 | * {@inheritdoc} |
||
262 | * |
||
263 | * @return Scope |
||
264 | */ |
||
265 | public function getScope() |
||
269 | |||
270 | /** |
||
271 | * {@inheritdoc} |
||
272 | * |
||
273 | * @param Scope $scope |
||
274 | * @return mixed |
||
275 | */ |
||
276 | public function setScope(Scope $scope) |
||
281 | |||
282 | /** |
||
283 | * Get the file this test belongs to. |
||
284 | * |
||
285 | * @return string |
||
286 | */ |
||
287 | public function getFile() |
||
291 | |||
292 | /** |
||
293 | * Set the file this test belongs to. |
||
294 | * |
||
295 | * @param string $file |
||
296 | */ |
||
297 | public function setFile($file) |
||
302 | |||
303 | /** |
||
304 | * {@inheritdoc} |
||
305 | * |
||
306 | * @param array $args |
||
307 | * @return $this |
||
308 | */ |
||
309 | public function setDefinitionArguments(array $args) |
||
313 | |||
314 | /** |
||
315 | * {@inheritdoc} |
||
316 | * |
||
317 | * @return array |
||
318 | */ |
||
319 | public function getDefinitionArguments() |
||
323 | } |
||
324 |