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|null |
||
52 | */ |
||
53 | protected $focused = null; |
||
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 | */ |
||
74 | public function __construct($description, callable $definition) |
||
80 | |||
81 | /** |
||
82 | * {@inheritdoc} |
||
83 | * |
||
84 | * @param callable $setupFn |
||
85 | */ |
||
86 | public function addSetupFunction(callable $setupFn) |
||
91 | |||
92 | /** |
||
93 | * {@inheritdoc} |
||
94 | * |
||
95 | * @param callable $tearDownFn |
||
96 | */ |
||
97 | public function addTearDownFunction(callable $tearDownFn) |
||
102 | |||
103 | /** |
||
104 | * {@inheritdoc} |
||
105 | * |
||
106 | * @return string |
||
107 | */ |
||
108 | public function getDescription() |
||
112 | |||
113 | /** |
||
114 | * {@inheritdoc} |
||
115 | * |
||
116 | * @return callable |
||
117 | */ |
||
118 | public function getDefinition() |
||
122 | |||
123 | /** |
||
124 | * {@inheritdoc} |
||
125 | * |
||
126 | * @param TestInterface $parent |
||
127 | * @return mixed|void |
||
128 | */ |
||
129 | public function setParent(TestInterface $parent) |
||
134 | |||
135 | /** |
||
136 | * {@inheritdoc} |
||
137 | * |
||
138 | * @return TestInterface |
||
139 | */ |
||
140 | public function getParent() |
||
144 | |||
145 | /** |
||
146 | * {@inheritdoc} |
||
147 | * |
||
148 | * @return string |
||
149 | */ |
||
150 | public function getTitle() |
||
161 | |||
162 | /** |
||
163 | * {@inheritdoc} |
||
164 | * |
||
165 | * @return bool|null |
||
166 | */ |
||
167 | public function getPending() |
||
171 | |||
172 | /** |
||
173 | * {@inheritdoc} |
||
174 | * |
||
175 | * @param bool $state |
||
176 | */ |
||
177 | public function setPending($state) |
||
181 | |||
182 | /** |
||
183 | * {@inheritdoc} |
||
184 | * |
||
185 | * @return bool|null |
||
186 | */ |
||
187 | public function getFocused() |
||
191 | |||
192 | /** |
||
193 | * {@inheritdoc} |
||
194 | * |
||
195 | * @param bool $state |
||
196 | */ |
||
197 | public function setFocused($state) |
||
201 | |||
202 | /** |
||
203 | * {@inheritdoc} |
||
204 | * |
||
205 | * @return array |
||
206 | */ |
||
207 | public function getSetupFunctions() |
||
211 | |||
212 | /** |
||
213 | * {@inheritdoc} |
||
214 | * |
||
215 | * @return array |
||
216 | */ |
||
217 | public function getTearDownFunctions() |
||
221 | |||
222 | /** |
||
223 | * {@inheritdoc} |
||
224 | * |
||
225 | * @param callable $fn |
||
226 | */ |
||
227 | public function forEachNodeBottomUp(callable $fn) |
||
235 | |||
236 | /** |
||
237 | * {@inheritdoc} |
||
238 | * |
||
239 | * @param callable $fn |
||
240 | */ |
||
241 | public function forEachNodeTopDown(callable $fn) |
||
253 | |||
254 | /** |
||
255 | * {@inheritdoc} |
||
256 | * |
||
257 | * @return Scope |
||
258 | */ |
||
259 | public function getScope() |
||
263 | |||
264 | /** |
||
265 | * {@inheritdoc} |
||
266 | * |
||
267 | * @param Scope $scope |
||
268 | * @return mixed |
||
269 | */ |
||
270 | public function setScope(Scope $scope) |
||
275 | |||
276 | /** |
||
277 | * Get the file this test belongs to. |
||
278 | * |
||
279 | * @return string |
||
280 | */ |
||
281 | public function getFile() |
||
285 | |||
286 | /** |
||
287 | * Set the file this test belongs to. |
||
288 | * |
||
289 | * @param string $file |
||
290 | */ |
||
291 | public function setFile($file) |
||
296 | |||
297 | /** |
||
298 | * {@inheritdoc} |
||
299 | * |
||
300 | * @param array $args |
||
301 | * @return $this |
||
302 | */ |
||
303 | public function setDefinitionArguments(array $args) |
||
307 | |||
308 | /** |
||
309 | * {@inheritdoc} |
||
310 | * |
||
311 | * @return array |
||
312 | */ |
||
313 | public function getDefinitionArguments() |
||
317 | } |
||
318 |