@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |
@@ 8-573 (lines=566) @@ | ||
5 | // You should not change it manually as it will be overwritten on next build |
|
6 | // @codingStandardsIgnoreFile |
|
7 | ||
8 | trait UnitTesterActions |
|
9 | { |
|
10 | /** |
|
11 | * @return \Codeception\Scenario |
|
12 | */ |
|
13 | abstract protected function getScenario(); |
|
14 | ||
15 | ||
16 | /** |
|
17 | * [!] Method is generated. Documentation taken from corresponding module. |
|
18 | * |
|
19 | * Checks that two variables are equal. If you're comparing floating-point values, |
|
20 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
21 | * error are you willing to tolerate in order to consider the two values equal. |
|
22 | * |
|
23 | * Regular example: |
|
24 | * ```php |
|
25 | * <?php |
|
26 | * $I->assertEquals($element->getChildrenCount(), 5); |
|
27 | * ``` |
|
28 | * |
|
29 | * Floating-point example: |
|
30 | * ```php |
|
31 | * <?php |
|
32 | * $I->assertEquals($calculator->add(0.1, 0.2), 0.3, 'Calculator should add the two numbers correctly.', 0.01); |
|
33 | * ``` |
|
34 | * |
|
35 | * @param $expected |
|
36 | * @param $actual |
|
37 | * @param string $message |
|
38 | * @param float $delta |
|
39 | * @see \Codeception\Module\Asserts::assertEquals() |
|
40 | */ |
|
41 | public function assertEquals($expected, $actual, $message = null, $delta = null) { |
|
42 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEquals', func_get_args())); |
|
43 | } |
|
44 | ||
45 | ||
46 | /** |
|
47 | * [!] Method is generated. Documentation taken from corresponding module. |
|
48 | * |
|
49 | * Checks that two variables are not equal. If you're comparing floating-point values, |
|
50 | * you can specify the optional "delta" parameter which dictates how great of a precision |
|
51 | * error are you willing to tolerate in order to consider the two values not equal. |
|
52 | * |
|
53 | * Regular example: |
|
54 | * ```php |
|
55 | * <?php |
|
56 | * $I->assertNotEquals($element->getChildrenCount(), 0); |
|
57 | * ``` |
|
58 | * |
|
59 | * Floating-point example: |
|
60 | * ```php |
|
61 | * <?php |
|
62 | * $I->assertNotEquals($calculator->add(0.1, 0.2), 0.4, 'Calculator should add the two numbers correctly.', 0.01); |
|
63 | * ``` |
|
64 | * |
|
65 | * @param $expected |
|
66 | * @param $actual |
|
67 | * @param string $message |
|
68 | * @param float $delta |
|
69 | * @see \Codeception\Module\Asserts::assertNotEquals() |
|
70 | */ |
|
71 | public function assertNotEquals($expected, $actual, $message = null, $delta = null) { |
|
72 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEquals', func_get_args())); |
|
73 | } |
|
74 | ||
75 | ||
76 | /** |
|
77 | * [!] Method is generated. Documentation taken from corresponding module. |
|
78 | * |
|
79 | * Checks that two variables are same |
|
80 | * |
|
81 | * @param $expected |
|
82 | * @param $actual |
|
83 | * @param string $message |
|
84 | * @see \Codeception\Module\Asserts::assertSame() |
|
85 | */ |
|
86 | public function assertSame($expected, $actual, $message = null) { |
|
87 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertSame', func_get_args())); |
|
88 | } |
|
89 | ||
90 | ||
91 | /** |
|
92 | * [!] Method is generated. Documentation taken from corresponding module. |
|
93 | * |
|
94 | * Checks that two variables are not same |
|
95 | * |
|
96 | * @param $expected |
|
97 | * @param $actual |
|
98 | * @param string $message |
|
99 | * @see \Codeception\Module\Asserts::assertNotSame() |
|
100 | */ |
|
101 | public function assertNotSame($expected, $actual, $message = null) { |
|
102 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotSame', func_get_args())); |
|
103 | } |
|
104 | ||
105 | ||
106 | /** |
|
107 | * [!] Method is generated. Documentation taken from corresponding module. |
|
108 | * |
|
109 | * Checks that actual is greater than expected |
|
110 | * |
|
111 | * @param $expected |
|
112 | * @param $actual |
|
113 | * @param string $message |
|
114 | * @see \Codeception\Module\Asserts::assertGreaterThan() |
|
115 | */ |
|
116 | public function assertGreaterThan($expected, $actual, $message = null) { |
|
117 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThan', func_get_args())); |
|
118 | } |
|
119 | ||
120 | ||
121 | /** |
|
122 | * [!] Method is generated. Documentation taken from corresponding module. |
|
123 | * |
|
124 | * Checks that actual is greater or equal than expected |
|
125 | * |
|
126 | * @param $expected |
|
127 | * @param $actual |
|
128 | * @param string $message |
|
129 | * @see \Codeception\Module\Asserts::assertGreaterThanOrEqual() |
|
130 | */ |
|
131 | public function assertGreaterThanOrEqual($expected, $actual, $message = null) { |
|
132 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterThanOrEqual', func_get_args())); |
|
133 | } |
|
134 | ||
135 | ||
136 | /** |
|
137 | * [!] Method is generated. Documentation taken from corresponding module. |
|
138 | * |
|
139 | * Checks that actual is less than expected |
|
140 | * |
|
141 | * @param $expected |
|
142 | * @param $actual |
|
143 | * @param string $message |
|
144 | * @see \Codeception\Module\Asserts::assertLessThan() |
|
145 | */ |
|
146 | public function assertLessThan($expected, $actual, $message = null) { |
|
147 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThan', func_get_args())); |
|
148 | } |
|
149 | ||
150 | ||
151 | /** |
|
152 | * [!] Method is generated. Documentation taken from corresponding module. |
|
153 | * |
|
154 | * Checks that actual is less or equal than expected |
|
155 | * |
|
156 | * @param $expected |
|
157 | * @param $actual |
|
158 | * @param string $message |
|
159 | * @see \Codeception\Module\Asserts::assertLessThanOrEqual() |
|
160 | */ |
|
161 | public function assertLessThanOrEqual($expected, $actual, $message = null) { |
|
162 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessThanOrEqual', func_get_args())); |
|
163 | } |
|
164 | ||
165 | ||
166 | /** |
|
167 | * [!] Method is generated. Documentation taken from corresponding module. |
|
168 | * |
|
169 | * Checks that haystack contains needle |
|
170 | * |
|
171 | * @param $needle |
|
172 | * @param $haystack |
|
173 | * @param string $message |
|
174 | * @see \Codeception\Module\Asserts::assertContains() |
|
175 | */ |
|
176 | public function assertContains($needle, $haystack, $message = null) { |
|
177 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertContains', func_get_args())); |
|
178 | } |
|
179 | ||
180 | ||
181 | /** |
|
182 | * [!] Method is generated. Documentation taken from corresponding module. |
|
183 | * |
|
184 | * Checks that haystack doesn't contain needle. |
|
185 | * |
|
186 | * @param $needle |
|
187 | * @param $haystack |
|
188 | * @param string $message |
|
189 | * @see \Codeception\Module\Asserts::assertNotContains() |
|
190 | */ |
|
191 | public function assertNotContains($needle, $haystack, $message = null) { |
|
192 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotContains', func_get_args())); |
|
193 | } |
|
194 | ||
195 | ||
196 | /** |
|
197 | * [!] Method is generated. Documentation taken from corresponding module. |
|
198 | * |
|
199 | * Checks that string match with pattern |
|
200 | * |
|
201 | * @param string $pattern |
|
202 | * @param string $string |
|
203 | * @param string $message |
|
204 | * @see \Codeception\Module\Asserts::assertRegExp() |
|
205 | */ |
|
206 | public function assertRegExp($pattern, $string, $message = null) { |
|
207 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertRegExp', func_get_args())); |
|
208 | } |
|
209 | ||
210 | ||
211 | /** |
|
212 | * [!] Method is generated. Documentation taken from corresponding module. |
|
213 | * |
|
214 | * Checks that string not match with pattern |
|
215 | * |
|
216 | * @param string $pattern |
|
217 | * @param string $string |
|
218 | * @param string $message |
|
219 | * @see \Codeception\Module\Asserts::assertNotRegExp() |
|
220 | */ |
|
221 | public function assertNotRegExp($pattern, $string, $message = null) { |
|
222 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotRegExp', func_get_args())); |
|
223 | } |
|
224 | ||
225 | ||
226 | /** |
|
227 | * [!] Method is generated. Documentation taken from corresponding module. |
|
228 | * |
|
229 | * Checks that a string starts with the given prefix. |
|
230 | * |
|
231 | * @param string $prefix |
|
232 | * @param string $string |
|
233 | * @param string $message |
|
234 | * @see \Codeception\Module\Asserts::assertStringStartsWith() |
|
235 | */ |
|
236 | public function assertStringStartsWith($prefix, $string, $message = null) { |
|
237 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsWith', func_get_args())); |
|
238 | } |
|
239 | ||
240 | ||
241 | /** |
|
242 | * [!] Method is generated. Documentation taken from corresponding module. |
|
243 | * |
|
244 | * Checks that a string doesn't start with the given prefix. |
|
245 | * |
|
246 | * @param string $prefix |
|
247 | * @param string $string |
|
248 | * @param string $message |
|
249 | * @see \Codeception\Module\Asserts::assertStringStartsNotWith() |
|
250 | */ |
|
251 | public function assertStringStartsNotWith($prefix, $string, $message = null) { |
|
252 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertStringStartsNotWith', func_get_args())); |
|
253 | } |
|
254 | ||
255 | ||
256 | /** |
|
257 | * [!] Method is generated. Documentation taken from corresponding module. |
|
258 | * |
|
259 | * Checks that variable is empty. |
|
260 | * |
|
261 | * @param $actual |
|
262 | * @param string $message |
|
263 | * @see \Codeception\Module\Asserts::assertEmpty() |
|
264 | */ |
|
265 | public function assertEmpty($actual, $message = null) { |
|
266 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertEmpty', func_get_args())); |
|
267 | } |
|
268 | ||
269 | ||
270 | /** |
|
271 | * [!] Method is generated. Documentation taken from corresponding module. |
|
272 | * |
|
273 | * Checks that variable is not empty. |
|
274 | * |
|
275 | * @param $actual |
|
276 | * @param string $message |
|
277 | * @see \Codeception\Module\Asserts::assertNotEmpty() |
|
278 | */ |
|
279 | public function assertNotEmpty($actual, $message = null) { |
|
280 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotEmpty', func_get_args())); |
|
281 | } |
|
282 | ||
283 | ||
284 | /** |
|
285 | * [!] Method is generated. Documentation taken from corresponding module. |
|
286 | * |
|
287 | * Checks that variable is NULL |
|
288 | * |
|
289 | * @param $actual |
|
290 | * @param string $message |
|
291 | * @see \Codeception\Module\Asserts::assertNull() |
|
292 | */ |
|
293 | public function assertNull($actual, $message = null) { |
|
294 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNull', func_get_args())); |
|
295 | } |
|
296 | ||
297 | ||
298 | /** |
|
299 | * [!] Method is generated. Documentation taken from corresponding module. |
|
300 | * |
|
301 | * Checks that variable is not NULL |
|
302 | * |
|
303 | * @param $actual |
|
304 | * @param string $message |
|
305 | * @see \Codeception\Module\Asserts::assertNotNull() |
|
306 | */ |
|
307 | public function assertNotNull($actual, $message = null) { |
|
308 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotNull', func_get_args())); |
|
309 | } |
|
310 | ||
311 | ||
312 | /** |
|
313 | * [!] Method is generated. Documentation taken from corresponding module. |
|
314 | * |
|
315 | * Checks that condition is positive. |
|
316 | * |
|
317 | * @param $condition |
|
318 | * @param string $message |
|
319 | * @see \Codeception\Module\Asserts::assertTrue() |
|
320 | */ |
|
321 | public function assertTrue($condition, $message = null) { |
|
322 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertTrue', func_get_args())); |
|
323 | } |
|
324 | ||
325 | ||
326 | /** |
|
327 | * [!] Method is generated. Documentation taken from corresponding module. |
|
328 | * |
|
329 | * Checks that the condition is NOT true (everything but true) |
|
330 | * |
|
331 | * @param $condition |
|
332 | * @param string $message |
|
333 | * @see \Codeception\Module\Asserts::assertNotTrue() |
|
334 | */ |
|
335 | public function assertNotTrue($condition, $message = null) { |
|
336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotTrue', func_get_args())); |
|
337 | } |
|
338 | ||
339 | ||
340 | /** |
|
341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
342 | * |
|
343 | * Checks that condition is negative. |
|
344 | * |
|
345 | * @param $condition |
|
346 | * @param string $message |
|
347 | * @see \Codeception\Module\Asserts::assertFalse() |
|
348 | */ |
|
349 | public function assertFalse($condition, $message = null) { |
|
350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
351 | } |
|
352 | ||
353 | ||
354 | /** |
|
355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
356 | * |
|
357 | * Checks that the condition is NOT false (everything but false) |
|
358 | * |
|
359 | * @param $condition |
|
360 | * @param string $message |
|
361 | * @see \Codeception\Module\Asserts::assertNotFalse() |
|
362 | */ |
|
363 | public function assertNotFalse($condition, $message = null) { |
|
364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotFalse', func_get_args())); |
|
365 | } |
|
366 | ||
367 | ||
368 | /** |
|
369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
370 | * |
|
371 | * Checks if file exists |
|
372 | * |
|
373 | * @param string $filename |
|
374 | * @param string $message |
|
375 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
376 | */ |
|
377 | public function assertFileExists($filename, $message = null) { |
|
378 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
379 | } |
|
380 | ||
381 | ||
382 | /** |
|
383 | * [!] Method is generated. Documentation taken from corresponding module. |
|
384 | * |
|
385 | * Checks if file doesn't exist |
|
386 | * |
|
387 | * @param string $filename |
|
388 | * @param string $message |
|
389 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
390 | */ |
|
391 | public function assertFileNotExists($filename, $message = null) { |
|
392 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
393 | } |
|
394 | ||
395 | ||
396 | /** |
|
397 | * [!] Method is generated. Documentation taken from corresponding module. |
|
398 | * |
|
399 | * @param $expected |
|
400 | * @param $actual |
|
401 | * @param $description |
|
402 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
403 | */ |
|
404 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
405 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
406 | } |
|
407 | ||
408 | ||
409 | /** |
|
410 | * [!] Method is generated. Documentation taken from corresponding module. |
|
411 | * |
|
412 | * @param $expected |
|
413 | * @param $actual |
|
414 | * @param $description |
|
415 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
416 | */ |
|
417 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
418 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
419 | } |
|
420 | ||
421 | ||
422 | /** |
|
423 | * [!] Method is generated. Documentation taken from corresponding module. |
|
424 | * |
|
425 | * @param $actual |
|
426 | * @param $description |
|
427 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
428 | */ |
|
429 | public function assertIsEmpty($actual, $description = null) { |
|
430 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
431 | } |
|
432 | ||
433 | ||
434 | /** |
|
435 | * [!] Method is generated. Documentation taken from corresponding module. |
|
436 | * |
|
437 | * @param $key |
|
438 | * @param $actual |
|
439 | * @param $description |
|
440 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
441 | */ |
|
442 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
443 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
444 | } |
|
445 | ||
446 | ||
447 | /** |
|
448 | * [!] Method is generated. Documentation taken from corresponding module. |
|
449 | * |
|
450 | * @param $key |
|
451 | * @param $actual |
|
452 | * @param $description |
|
453 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
454 | */ |
|
455 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
456 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
457 | } |
|
458 | ||
459 | ||
460 | /** |
|
461 | * [!] Method is generated. Documentation taken from corresponding module. |
|
462 | * |
|
463 | * Checks that array contains subset. |
|
464 | * |
|
465 | * @param array $subset |
|
466 | * @param array $array |
|
467 | * @param bool $strict |
|
468 | * @param string $message |
|
469 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
470 | */ |
|
471 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
472 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
473 | } |
|
474 | ||
475 | ||
476 | /** |
|
477 | * [!] Method is generated. Documentation taken from corresponding module. |
|
478 | * |
|
479 | * @param $expectedCount |
|
480 | * @param $actual |
|
481 | * @param $description |
|
482 | * @see \Codeception\Module\Asserts::assertCount() |
|
483 | */ |
|
484 | public function assertCount($expectedCount, $actual, $description = null) { |
|
485 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
486 | } |
|
487 | ||
488 | ||
489 | /** |
|
490 | * [!] Method is generated. Documentation taken from corresponding module. |
|
491 | * |
|
492 | * @param $class |
|
493 | * @param $actual |
|
494 | * @param $description |
|
495 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
496 | */ |
|
497 | public function assertInstanceOf($class, $actual, $description = null) { |
|
498 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
499 | } |
|
500 | ||
501 | ||
502 | /** |
|
503 | * [!] Method is generated. Documentation taken from corresponding module. |
|
504 | * |
|
505 | * @param $class |
|
506 | * @param $actual |
|
507 | * @param $description |
|
508 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
509 | */ |
|
510 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
511 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
512 | } |
|
513 | ||
514 | ||
515 | /** |
|
516 | * [!] Method is generated. Documentation taken from corresponding module. |
|
517 | * |
|
518 | * @param $type |
|
519 | * @param $actual |
|
520 | * @param $description |
|
521 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
522 | */ |
|
523 | public function assertInternalType($type, $actual, $description = null) { |
|
524 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
525 | } |
|
526 | ||
527 | ||
528 | /** |
|
529 | * [!] Method is generated. Documentation taken from corresponding module. |
|
530 | * |
|
531 | * Fails the test with message. |
|
532 | * |
|
533 | * @param $message |
|
534 | * @see \Codeception\Module\Asserts::fail() |
|
535 | */ |
|
536 | public function fail($message) { |
|
537 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
538 | } |
|
539 | ||
540 | ||
541 | /** |
|
542 | * [!] Method is generated. Documentation taken from corresponding module. |
|
543 | * |
|
544 | * Handles and checks exception called inside callback function. |
|
545 | * Either exception class name or exception instance should be provided. |
|
546 | * |
|
547 | * ```php |
|
548 | * <?php |
|
549 | * $I->expectException(MyException::class, function() { |
|
550 | * $this->doSomethingBad(); |
|
551 | * }); |
|
552 | * |
|
553 | * $I->expectException(new MyException(), function() { |
|
554 | * $this->doSomethingBad(); |
|
555 | * }); |
|
556 | * ``` |
|
557 | * If you want to check message or exception code, you can pass them with exception instance: |
|
558 | * ```php |
|
559 | * <?php |
|
560 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
561 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
562 | * $this->doSomethingBad(); |
|
563 | * }); |
|
564 | * ``` |
|
565 | * |
|
566 | * @param $exception string or \Exception |
|
567 | * @param $callback |
|
568 | * @see \Codeception\Module\Asserts::expectException() |
|
569 | */ |
|
570 | public function expectException($exception, $callback) { |
|
571 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
572 | } |
|
573 | } |
|
574 |