|
15 | 15 | use Codeception\Module\Laravel\InteractsWithConsole;
|
16 | 16 | use Codeception\Module\Laravel\InteractsWithContainer;
|
17 | 17 | use Codeception\Module\Laravel\InteractsWithEloquent;
|
| 18 | +use Codeception\Module\Laravel\InteractsWithEvents; |
18 | 19 | use Codeception\Subscriber\ErrorHandler;
|
19 | 20 | use Codeception\TestInterface;
|
20 | 21 | use Codeception\Util\ReflectionHelper;
|
@@ -130,6 +131,7 @@ class Laravel extends Framework implements ActiveRecord, PartedModule
|
130 | 131 | use InteractsWithConsole;
|
131 | 132 | use InteractsWithContainer;
|
132 | 133 | use InteractsWithEloquent;
|
| 134 | + use InteractsWithEvents; |
133 | 135 |
|
134 | 136 | /**
|
135 | 137 | * @var Application
|
@@ -330,83 +332,6 @@ public function disableMiddleware()
|
330 | 332 | $this->client->disableMiddleware();
|
331 | 333 | }
|
332 | 334 |
|
333 |
| - /** |
334 |
| - * Disable events for the next requests. |
335 |
| - * This method does not disable model events. |
336 |
| - * To disable model events you have to use the disableModelEvents() method. |
337 |
| - * |
338 |
| - * ```php |
339 |
| - * <?php |
340 |
| - * $I->disableEvents(); |
341 |
| - * ``` |
342 |
| - */ |
343 |
| - public function disableEvents(): void |
344 |
| - { |
345 |
| - $this->client->disableEvents(); |
346 |
| - } |
347 |
| - |
348 |
| - /** |
349 |
| - * Disable model events for the next requests. |
350 |
| - * |
351 |
| - * ```php |
352 |
| - * <?php |
353 |
| - * $I->disableModelEvents(); |
354 |
| - * ``` |
355 |
| - */ |
356 |
| - public function disableModelEvents(): void |
357 |
| - { |
358 |
| - $this->client->disableModelEvents(); |
359 |
| - } |
360 |
| - |
361 |
| - /** |
362 |
| - * Make sure events fired during the test. |
363 |
| - * |
364 |
| - * ```php |
365 |
| - * <?php |
366 |
| - * $I->seeEventTriggered('App\MyEvent'); |
367 |
| - * $I->seeEventTriggered(new App\Events\MyEvent()); |
368 |
| - * $I->seeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']); |
369 |
| - * ``` |
370 |
| - * @param string|object|string[] $expected |
371 |
| - */ |
372 |
| - public function seeEventTriggered($expected): void |
373 |
| - { |
374 |
| - $expected = is_array($expected) ? $expected : [$expected]; |
375 |
| - |
376 |
| - foreach ($expected as $expectedEvent) { |
377 |
| - if (! $this->client->eventTriggered($expectedEvent)) { |
378 |
| - $expectedEvent = is_object($expectedEvent) ? get_class($expectedEvent) : $expectedEvent; |
379 |
| - |
380 |
| - $this->fail("The '$expectedEvent' event did not trigger"); |
381 |
| - } |
382 |
| - } |
383 |
| - } |
384 |
| - |
385 |
| - /** |
386 |
| - * Make sure events did not fire during the test. |
387 |
| - * |
388 |
| - * ``` php |
389 |
| - * <?php |
390 |
| - * $I->dontSeeEventTriggered('App\MyEvent'); |
391 |
| - * $I->dontSeeEventTriggered(new App\Events\MyEvent()); |
392 |
| - * $I->dontSeeEventTriggered(['App\MyEvent', 'App\MyOtherEvent']); |
393 |
| - * ``` |
394 |
| - * @param string|object|string[] $expected |
395 |
| - */ |
396 |
| - public function dontSeeEventTriggered($expected): void |
397 |
| - { |
398 |
| - $expected = is_array($expected) ? $expected : [$expected]; |
399 |
| - |
400 |
| - foreach ($expected as $expectedEvent) { |
401 |
| - $triggered = $this->client->eventTriggered($expectedEvent); |
402 |
| - if ($triggered) { |
403 |
| - $expectedEvent = is_object($expectedEvent) ? get_class($expectedEvent) : $expectedEvent; |
404 |
| - |
405 |
| - $this->fail("The '$expectedEvent' event triggered"); |
406 |
| - } |
407 |
| - } |
408 |
| - } |
409 |
| - |
410 | 335 | /**
|
411 | 336 | * Opens web page using route name and parameters.
|
412 | 337 | *
|
|
0 commit comments