1 | <?php //[STAMP] 1467e0d5027bbc2413077351642a21f3 |
||
11 | trait UnitTesterActions |
||
12 | { |
||
13 | /** |
||
14 | * @return \Codeception\Scenario |
||
15 | */ |
||
16 | abstract protected function getScenario(); |
||
17 | |||
18 | |||
19 | /** |
||
20 | * [!] Method is generated. Documentation taken from corresponding module. |
||
21 | * |
||
22 | * Checks that two variables are equal. If you're comparing floating-point values, |
||
23 | * you can specify the optional "delta" parameter which dictates how great of a precision |
||
24 | * error are you willing to tolerate in order to consider the two values equal. |
||
25 | * |
||
26 | * Regular example: |
||
27 | * ```php |
||
28 | * <?php |
||
29 | * $I->assertEquals($element->getChildrenCount(), 5); |
||
30 | * ``` |
||
31 | * |
||
32 | * Floating-point example: |
||
33 | * ```php |
||
34 | * <?php |
||
35 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
||
36 | * ``` |
||
37 | * |
||
38 | * @param $expected |
||
39 | * @param $actual |
||
40 | * @param string $message |
||
41 | * @param float $delta |
||
42 | * @see \Codeception\Module\Asserts::assertEquals() |
||
43 | */ |
||
44 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
||
47 | |||
48 | |||
49 | /** |
||
50 | * [!] Method is generated. Documentation taken from corresponding module. |
||
51 | * |
||
52 | * Checks that two variables are not equal. If you're comparing floating-point values, |
||
53 | * you can specify the optional "delta" parameter which dictates how great of a precision |
||
54 | * error are you willing to tolerate in order to consider the two values not equal. |
||
55 | * |
||
56 | * Regular example: |
||
57 | * ```php |
||
58 | * <?php |
||
59 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
||
60 | * ``` |
||
61 | * |
||
62 | * Floating-point example: |
||
63 | * ```php |
||
64 | * <?php |
||
65 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
||
66 | * ``` |
||
67 | * |
||
68 | * @param $expected |
||
69 | * @param $actual |
||
70 | * @param string $message |
||
71 | * @param float $delta |
||
72 | * @see \Codeception\Module\Asserts::assertNotEquals() |
||
73 | */ |
||
74 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
||
77 | |||
78 | |||
79 | /** |
||
80 | * [!] Method is generated. Documentation taken from corresponding module. |
||
81 | * |
||
82 | * Checks that two variables are same |
||
83 | * |
||
84 | * @param $expected |
||
85 | * @param $actual |
||
86 | * @param string $message |
||
87 | * @see \Codeception\Module\Asserts::assertSame() |
||
88 | */ |
||
89 | public function assertSame($expected, $actual, $message = null) { |
||
92 | |||
93 | |||
94 | /** |
||
95 | * [!] Method is generated. Documentation taken from corresponding module. |
||
96 | * |
||
97 | * Checks that two variables are not same |
||
98 | * |
||
99 | * @param $expected |
||
100 | * @param $actual |
||
101 | * @param string $message |
||
102 | * @see \Codeception\Module\Asserts::assertNotSame() |
||
103 | */ |
||
104 | public function assertNotSame($expected, $actual, $message = null) { |
||
107 | |||
108 | |||
109 | /** |
||
110 | * [!] Method is generated. Documentation taken from corresponding module. |
||
111 | * |
||
112 | * Checks that actual is greater than expected |
||
113 | * |
||
114 | * @param $expected |
||
115 | * @param $actual |
||
116 | * @param string $message |
||
117 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
||
118 | */ |
||
119 | public function assertGreaterThan($expected, $actual, $message = null) { |
||
122 | |||
123 | |||
124 | /** |
||
125 | * [!] Method is generated. Documentation taken from corresponding module. |
||
126 | * |
||
127 | * Checks that actual is greater or equal than expected |
||
128 | * |
||
129 | * @param $expected |
||
130 | * @param $actual |
||
131 | * @param string $message |
||
132 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
||
133 | */ |
||
134 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
||
137 | |||
138 | |||
139 | /** |
||
140 | * [!] Method is generated. Documentation taken from corresponding module. |
||
141 | * |
||
142 | * Checks that actual is less than expected |
||
143 | * |
||
144 | * @param $expected |
||
145 | * @param $actual |
||
146 | * @param string $message |
||
147 | * @see \Codeception\Module\Asserts::assertLessThan() |
||
148 | */ |
||
149 | public function assertLessThan($expected, $actual, $message = null) { |
||
152 | |||
153 | |||
154 | /** |
||
155 | * [!] Method is generated. Documentation taken from corresponding module. |
||
156 | * |
||
157 | * Checks that actual is less or equal than expected |
||
158 | * |
||
159 | * @param $expected |
||
160 | * @param $actual |
||
161 | * @param string $message |
||
162 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
||
163 | */ |
||
164 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
||
167 | |||
168 | |||
169 | /** |
||
170 | * [!] Method is generated. Documentation taken from corresponding module. |
||
171 | * |
||
172 | * Checks that haystack contains needle |
||
173 | * |
||
174 | * @param $needle |
||
175 | * @param $haystack |
||
176 | * @param string $message |
||
177 | * @see \Codeception\Module\Asserts::assertContains() |
||
178 | */ |
||
179 | public function assertContains($needle, $haystack, $message = null) { |
||
182 | |||
183 | |||
184 | /** |
||
185 | * [!] Method is generated. Documentation taken from corresponding module. |
||
186 | * |
||
187 | * Checks that haystack doesn't contain needle. |
||
188 | * |
||
189 | * @param $needle |
||
190 | * @param $haystack |
||
191 | * @param string $message |
||
192 | * @see \Codeception\Module\Asserts::assertNotContains() |
||
193 | */ |
||
194 | public function assertNotContains($needle, $haystack, $message = null) { |
||
197 | |||
198 | |||
199 | /** |
||
200 | * [!] Method is generated. Documentation taken from corresponding module. |
||
201 | * |
||
202 | * Checks that string match with pattern |
||
203 | * |
||
204 | * @param string $pattern |
||
205 | * @param string $string |
||
206 | * @param string $message |
||
207 | * @see \Codeception\Module\Asserts::assertRegExp() |
||
208 | */ |
||
209 | public function assertRegExp($pattern, $string, $message = null) { |
||
212 | |||
213 | |||
214 | /** |
||
215 | * [!] Method is generated. Documentation taken from corresponding module. |
||
216 | * |
||
217 | * Checks that string not match with pattern |
||
218 | * |
||
219 | * @param string $pattern |
||
220 | * @param string $string |
||
221 | * @param string $message |
||
222 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
||
223 | */ |
||
224 | public function assertNotRegExp($pattern, $string, $message = null) { |
||
227 | |||
228 | |||
229 | /** |
||
230 | * [!] Method is generated. Documentation taken from corresponding module. |
||
231 | * |
||
232 | * Checks that a string starts with the given prefix. |
||
233 | * |
||
234 | * @param string $prefix |
||
235 | * @param string $string |
||
236 | * @param string $message |
||
237 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
||
238 | */ |
||
239 | public function assertStringStartsWith($prefix, $string, $message = null) { |
||
242 | |||
243 | |||
244 | /** |
||
245 | * [!] Method is generated. Documentation taken from corresponding module. |
||
246 | * |
||
247 | * Checks that a string doesn't start with the given prefix. |
||
248 | * |
||
249 | * @param string $prefix |
||
250 | * @param string $string |
||
251 | * @param string $message |
||
252 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
||
253 | */ |
||
254 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
||
257 | |||
258 | |||
259 | /** |
||
260 | * [!] Method is generated. Documentation taken from corresponding module. |
||
261 | * |
||
262 | * Checks that variable is empty. |
||
263 | * |
||
264 | * @param $actual |
||
265 | * @param string $message |
||
266 | * @see \Codeception\Module\Asserts::assertEmpty() |
||
267 | */ |
||
268 | public function assertEmpty($actual, $message = null) { |
||
271 | |||
272 | |||
273 | /** |
||
274 | * [!] Method is generated. Documentation taken from corresponding module. |
||
275 | * |
||
276 | * Checks that variable is not empty. |
||
277 | * |
||
278 | * @param $actual |
||
279 | * @param string $message |
||
280 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
||
281 | */ |
||
282 | public function assertNotEmpty($actual, $message = null) { |
||
285 | |||
286 | |||
287 | /** |
||
288 | * [!] Method is generated. Documentation taken from corresponding module. |
||
289 | * |
||
290 | * Checks that variable is NULL |
||
291 | * |
||
292 | * @param $actual |
||
293 | * @param string $message |
||
294 | * @see \Codeception\Module\Asserts::assertNull() |
||
295 | */ |
||
296 | public function assertNull($actual, $message = null) { |
||
299 | |||
300 | |||
301 | /** |
||
302 | * [!] Method is generated. Documentation taken from corresponding module. |
||
303 | * |
||
304 | * Checks that variable is not NULL |
||
305 | * |
||
306 | * @param $actual |
||
307 | * @param string $message |
||
308 | * @see \Codeception\Module\Asserts::assertNotNull() |
||
309 | */ |
||
310 | public function assertNotNull($actual, $message = null) { |
||
313 | |||
314 | |||
315 | /** |
||
316 | * [!] Method is generated. Documentation taken from corresponding module. |
||
317 | * |
||
318 | * Checks that condition is positive. |
||
319 | * |
||
320 | * @param $condition |
||
321 | * @param string $message |
||
322 | * @see \Codeception\Module\Asserts::assertTrue() |
||
323 | */ |
||
324 | public function assertTrue($condition, $message = null) { |
||
327 | |||
328 | |||
329 | /** |
||
330 | * [!] Method is generated. Documentation taken from corresponding module. |
||
331 | * |
||
332 | * Checks that condition is negative. |
||
333 | * |
||
334 | * @param $condition |
||
335 | * @param string $message |
||
336 | * @see \Codeception\Module\Asserts::assertFalse() |
||
337 | */ |
||
338 | public function assertFalse($condition, $message = null) { |
||
341 | |||
342 | |||
343 | /** |
||
344 | * [!] Method is generated. Documentation taken from corresponding module. |
||
345 | * |
||
346 | * Checks if file exists |
||
347 | * |
||
348 | * @param string $filename |
||
349 | * @param string $message |
||
350 | * @see \Codeception\Module\Asserts::assertFileExists() |
||
351 | */ |
||
352 | public function assertFileExists($filename, $message = null) { |
||
355 | |||
356 | |||
357 | /** |
||
358 | * [!] Method is generated. Documentation taken from corresponding module. |
||
359 | * |
||
360 | * Checks if file doesn't exist |
||
361 | * |
||
362 | * @param string $filename |
||
363 | * @param string $message |
||
364 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
||
365 | */ |
||
366 | public function assertFileNotExists($filename, $message = null) { |
||
369 | |||
370 | |||
371 | /** |
||
372 | * [!] Method is generated. Documentation taken from corresponding module. |
||
373 | * |
||
374 | * @param $expected |
||
375 | * @param $actual |
||
376 | * @param $description |
||
377 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
||
378 | */ |
||
379 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
||
382 | |||
383 | |||
384 | /** |
||
385 | * [!] Method is generated. Documentation taken from corresponding module. |
||
386 | * |
||
387 | * @param $expected |
||
388 | * @param $actual |
||
389 | * @param $description |
||
390 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
||
391 | */ |
||
392 | public function assertLessOrEquals($expected, $actual, $description = null) { |
||
395 | |||
396 | |||
397 | /** |
||
398 | * [!] Method is generated. Documentation taken from corresponding module. |
||
399 | * |
||
400 | * @param $actual |
||
401 | * @param $description |
||
402 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
||
403 | */ |
||
404 | public function assertIsEmpty($actual, $description = null) { |
||
407 | |||
408 | |||
409 | /** |
||
410 | * [!] Method is generated. Documentation taken from corresponding module. |
||
411 | * |
||
412 | * @param $key |
||
413 | * @param $actual |
||
414 | * @param $description |
||
415 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
||
416 | */ |
||
417 | public function assertArrayHasKey($key, $actual, $description = null) { |
||
420 | |||
421 | |||
422 | /** |
||
423 | * [!] Method is generated. Documentation taken from corresponding module. |
||
424 | * |
||
425 | * @param $key |
||
426 | * @param $actual |
||
427 | * @param $description |
||
428 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
||
429 | */ |
||
430 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
||
433 | |||
434 | |||
435 | /** |
||
436 | * [!] Method is generated. Documentation taken from corresponding module. |
||
437 | * |
||
438 | * Checks that array contains subset. |
||
439 | * |
||
440 | * @param array $subset |
||
441 | * @param array $array |
||
442 | * @param bool $strict |
||
443 | * @param string $message |
||
444 | * @see \Codeception\Module::assertArraySubset() |
||
445 | */ |
||
446 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
||
449 | |||
450 | |||
451 | /** |
||
452 | * [!] Method is generated. Documentation taken from corresponding module. |
||
453 | * |
||
454 | * @param $expectedCount |
||
455 | * @param $actual |
||
456 | * @param $description |
||
457 | * @see \Codeception\Module\Asserts::assertCount() |
||
458 | */ |
||
459 | public function assertCount($expectedCount, $actual, $description = null) { |
||
462 | |||
463 | |||
464 | /** |
||
465 | * [!] Method is generated. Documentation taken from corresponding module. |
||
466 | * |
||
467 | * @param $class |
||
468 | * @param $actual |
||
469 | * @param $description |
||
470 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
||
471 | */ |
||
472 | public function assertInstanceOf($class, $actual, $description = null) { |
||
475 | |||
476 | |||
477 | /** |
||
478 | * [!] Method is generated. Documentation taken from corresponding module. |
||
479 | * |
||
480 | * @param $class |
||
481 | * @param $actual |
||
482 | * @param $description |
||
483 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
||
484 | */ |
||
485 | public function assertNotInstanceOf($class, $actual, $description = null) { |
||
488 | |||
489 | |||
490 | /** |
||
491 | * [!] Method is generated. Documentation taken from corresponding module. |
||
492 | * |
||
493 | * @param $type |
||
494 | * @param $actual |
||
495 | * @param $description |
||
496 | * @see \Codeception\Module\Asserts::assertInternalType() |
||
497 | */ |
||
498 | public function assertInternalType($type, $actual, $description = null) { |
||
501 | |||
502 | |||
503 | /** |
||
504 | * [!] Method is generated. Documentation taken from corresponding module. |
||
505 | * |
||
506 | * Fails the test with message. |
||
507 | * |
||
508 | * @param $message |
||
509 | * @see \Codeception\Module\Asserts::fail() |
||
510 | */ |
||
511 | public function fail($message) { |
||
514 | |||
515 | |||
516 | /** |
||
517 | * [!] Method is generated. Documentation taken from corresponding module. |
||
518 | * |
||
519 | * Handles and checks exception called inside callback function. |
||
520 | * Either exception class name or exception instance should be provided. |
||
521 | * |
||
522 | * ```php |
||
523 | * <?php |
||
524 | * $I->expectException(MyException::class, function() { |
||
525 | * $this->doSomethingBad(); |
||
526 | * }); |
||
527 | * |
||
528 | * $I->expectException(new MyException(), function() { |
||
529 | * $this->doSomethingBad(); |
||
530 | * }); |
||
531 | * ``` |
||
532 | * If you want to check message or exception code, you can pass them with exception instance: |
||
533 | * ```php |
||
534 | * <?php |
||
535 | * // will check that exception MyException is thrown with "Don't do bad things" message |
||
536 | * $I->expectException(new MyException("Don't do bad things"), function() { |
||
537 | * $this->doSomethingBad(); |
||
538 | * }); |
||
539 | * ``` |
||
540 | * |
||
541 | * @param $exception string or \Exception |
||
542 | * @param $callback |
||
543 | * @see \Codeception\Module\Asserts::expectException() |
||
544 | */ |
||
545 | public function expectException($exception, $callback) { |
||
548 | } |
||
549 |
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.