| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||
| @@ 8-545 (lines=538) @@ | ||
| 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 condition is negative. |
|
| 330 | * |
|
| 331 | * @param $condition |
|
| 332 | * @param string $message |
|
| 333 | * @see \Codeception\Module\Asserts::assertFalse() |
|
| 334 | */ |
|
| 335 | public function assertFalse($condition, $message = null) { |
|
| 336 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFalse', func_get_args())); |
|
| 337 | } |
|
| 338 | ||
| 339 | ||
| 340 | /** |
|
| 341 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 342 | * |
|
| 343 | * Checks if file exists |
|
| 344 | * |
|
| 345 | * @param string $filename |
|
| 346 | * @param string $message |
|
| 347 | * @see \Codeception\Module\Asserts::assertFileExists() |
|
| 348 | */ |
|
| 349 | public function assertFileExists($filename, $message = null) { |
|
| 350 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileExists', func_get_args())); |
|
| 351 | } |
|
| 352 | ||
| 353 | ||
| 354 | /** |
|
| 355 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 356 | * |
|
| 357 | * Checks if file doesn't exist |
|
| 358 | * |
|
| 359 | * @param string $filename |
|
| 360 | * @param string $message |
|
| 361 | * @see \Codeception\Module\Asserts::assertFileNotExists() |
|
| 362 | */ |
|
| 363 | public function assertFileNotExists($filename, $message = null) { |
|
| 364 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertFileNotExists', func_get_args())); |
|
| 365 | } |
|
| 366 | ||
| 367 | ||
| 368 | /** |
|
| 369 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 370 | * |
|
| 371 | * @param $expected |
|
| 372 | * @param $actual |
|
| 373 | * @param $description |
|
| 374 | * @see \Codeception\Module\Asserts::assertGreaterOrEquals() |
|
| 375 | */ |
|
| 376 | public function assertGreaterOrEquals($expected, $actual, $description = null) { |
|
| 377 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertGreaterOrEquals', func_get_args())); |
|
| 378 | } |
|
| 379 | ||
| 380 | ||
| 381 | /** |
|
| 382 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 383 | * |
|
| 384 | * @param $expected |
|
| 385 | * @param $actual |
|
| 386 | * @param $description |
|
| 387 | * @see \Codeception\Module\Asserts::assertLessOrEquals() |
|
| 388 | */ |
|
| 389 | public function assertLessOrEquals($expected, $actual, $description = null) { |
|
| 390 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertLessOrEquals', func_get_args())); |
|
| 391 | } |
|
| 392 | ||
| 393 | ||
| 394 | /** |
|
| 395 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 396 | * |
|
| 397 | * @param $actual |
|
| 398 | * @param $description |
|
| 399 | * @see \Codeception\Module\Asserts::assertIsEmpty() |
|
| 400 | */ |
|
| 401 | public function assertIsEmpty($actual, $description = null) { |
|
| 402 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertIsEmpty', func_get_args())); |
|
| 403 | } |
|
| 404 | ||
| 405 | ||
| 406 | /** |
|
| 407 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 408 | * |
|
| 409 | * @param $key |
|
| 410 | * @param $actual |
|
| 411 | * @param $description |
|
| 412 | * @see \Codeception\Module\Asserts::assertArrayHasKey() |
|
| 413 | */ |
|
| 414 | public function assertArrayHasKey($key, $actual, $description = null) { |
|
| 415 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayHasKey', func_get_args())); |
|
| 416 | } |
|
| 417 | ||
| 418 | ||
| 419 | /** |
|
| 420 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 421 | * |
|
| 422 | * @param $key |
|
| 423 | * @param $actual |
|
| 424 | * @param $description |
|
| 425 | * @see \Codeception\Module\Asserts::assertArrayNotHasKey() |
|
| 426 | */ |
|
| 427 | public function assertArrayNotHasKey($key, $actual, $description = null) { |
|
| 428 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArrayNotHasKey', func_get_args())); |
|
| 429 | } |
|
| 430 | ||
| 431 | ||
| 432 | /** |
|
| 433 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 434 | * |
|
| 435 | * Checks that array contains subset. |
|
| 436 | * |
|
| 437 | * @param array $subset |
|
| 438 | * @param array $array |
|
| 439 | * @param bool $strict |
|
| 440 | * @param string $message |
|
| 441 | * @see \Codeception\Module\Asserts::assertArraySubset() |
|
| 442 | */ |
|
| 443 | public function assertArraySubset($subset, $array, $strict = null, $message = null) { |
|
| 444 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertArraySubset', func_get_args())); |
|
| 445 | } |
|
| 446 | ||
| 447 | ||
| 448 | /** |
|
| 449 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 450 | * |
|
| 451 | * @param $expectedCount |
|
| 452 | * @param $actual |
|
| 453 | * @param $description |
|
| 454 | * @see \Codeception\Module\Asserts::assertCount() |
|
| 455 | */ |
|
| 456 | public function assertCount($expectedCount, $actual, $description = null) { |
|
| 457 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertCount', func_get_args())); |
|
| 458 | } |
|
| 459 | ||
| 460 | ||
| 461 | /** |
|
| 462 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 463 | * |
|
| 464 | * @param $class |
|
| 465 | * @param $actual |
|
| 466 | * @param $description |
|
| 467 | * @see \Codeception\Module\Asserts::assertInstanceOf() |
|
| 468 | */ |
|
| 469 | public function assertInstanceOf($class, $actual, $description = null) { |
|
| 470 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInstanceOf', func_get_args())); |
|
| 471 | } |
|
| 472 | ||
| 473 | ||
| 474 | /** |
|
| 475 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 476 | * |
|
| 477 | * @param $class |
|
| 478 | * @param $actual |
|
| 479 | * @param $description |
|
| 480 | * @see \Codeception\Module\Asserts::assertNotInstanceOf() |
|
| 481 | */ |
|
| 482 | public function assertNotInstanceOf($class, $actual, $description = null) { |
|
| 483 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertNotInstanceOf', func_get_args())); |
|
| 484 | } |
|
| 485 | ||
| 486 | ||
| 487 | /** |
|
| 488 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 489 | * |
|
| 490 | * @param $type |
|
| 491 | * @param $actual |
|
| 492 | * @param $description |
|
| 493 | * @see \Codeception\Module\Asserts::assertInternalType() |
|
| 494 | */ |
|
| 495 | public function assertInternalType($type, $actual, $description = null) { |
|
| 496 | return $this->getScenario()->runStep(new \Codeception\Step\Action('assertInternalType', func_get_args())); |
|
| 497 | } |
|
| 498 | ||
| 499 | ||
| 500 | /** |
|
| 501 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 502 | * |
|
| 503 | * Fails the test with message. |
|
| 504 | * |
|
| 505 | * @param $message |
|
| 506 | * @see \Codeception\Module\Asserts::fail() |
|
| 507 | */ |
|
| 508 | public function fail($message) { |
|
| 509 | return $this->getScenario()->runStep(new \Codeception\Step\Action('fail', func_get_args())); |
|
| 510 | } |
|
| 511 | ||
| 512 | ||
| 513 | /** |
|
| 514 | * [!] Method is generated. Documentation taken from corresponding module. |
|
| 515 | * |
|
| 516 | * Handles and checks exception called inside callback function. |
|
| 517 | * Either exception class name or exception instance should be provided. |
|
| 518 | * |
|
| 519 | * ```php |
|
| 520 | * <?php |
|
| 521 | * $I->expectException(MyException::class, function() { |
|
| 522 | * $this->doSomethingBad(); |
|
| 523 | * }); |
|
| 524 | * |
|
| 525 | * $I->expectException(new MyException(), function() { |
|
| 526 | * $this->doSomethingBad(); |
|
| 527 | * }); |
|
| 528 | * ``` |
|
| 529 | * If you want to check message or exception code, you can pass them with exception instance: |
|
| 530 | * ```php |
|
| 531 | * <?php |
|
| 532 | * // will check that exception MyException is thrown with "Don't do bad things" message |
|
| 533 | * $I->expectException(new MyException("Don't do bad things"), function() { |
|
| 534 | * $this->doSomethingBad(); |
|
| 535 | * }); |
|
| 536 | * ``` |
|
| 537 | * |
|
| 538 | * @param $exception string or \Exception |
|
| 539 | * @param $callback |
|
| 540 | * @see \Codeception\Module\Asserts::expectException() |
|
| 541 | */ |
|
| 542 | public function expectException($exception, $callback) { |
|
| 543 | return $this->getScenario()->runStep(new \Codeception\Step\Action('expectException', func_get_args())); |
|
| 544 | } |
|
| 545 | } |
|
| 546 | ||