|
6 | 6 |
|
7 | 7 | use App\Event\UserRegisteredEvent; |
8 | 8 | use App\Tests\FunctionalTester; |
| 9 | +use PHPUnit\Framework\ExpectationFailedException; |
9 | 10 | use Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector; |
10 | 11 | use Symfony\Component\Console\ConsoleEvents; |
11 | 12 | use Symfony\Component\Console\EventListener\ErrorListener; |
@@ -43,14 +44,13 @@ public function dontSeeOrphanEvent(FunctionalTester $I) |
43 | 44 | $I->submitForm('form[name=login]', [ |
44 | 45 | 'email' => 'john_doe@gmail.com', |
45 | 46 | 'password' => '123456', |
46 | | - '_remember_me' => false |
| 47 | + '_remember_me' => false, |
47 | 48 | ]); |
48 | 49 | $I->dontSeeOrphanEvent(); |
49 | 50 | } |
50 | 51 |
|
51 | 52 | public function dontSeeEvent(FunctionalTester $I) |
52 | 53 | { |
53 | | - $I->markTestSkipped(); |
54 | 54 | $I->amOnPage('/'); |
55 | 55 | $I->dontSeeEvent(KernelEvents::EXCEPTION); |
56 | 56 | $I->dontSeeEvent([new UserRegisteredEvent(), ConsoleEvents::COMMAND]); |
@@ -85,22 +85,28 @@ public function seeOrphanEvent(FunctionalTester $I) |
85 | 85 | $I->submitSymfonyForm('registration_form', [ |
86 | 86 | '[email]' => 'jane_doe@gmail.com', |
87 | 87 | '[plainPassword]' => '123456', |
88 | | - '[agreeTerms]' => true |
| 88 | + '[agreeTerms]' => true, |
89 | 89 | ]); |
90 | 90 | $I->seeOrphanEvent(UserRegisteredEvent::class); |
91 | 91 | } |
92 | 92 |
|
93 | 93 | public function seeEvent(FunctionalTester $I) |
94 | 94 | { |
95 | | - $I->markTestSkipped(); |
96 | 95 | $I->amOnPage('/register'); |
97 | 96 | $I->stopFollowingRedirects(); |
98 | 97 | $I->submitSymfonyForm('registration_form', [ |
99 | 98 | '[email]' => 'jane_doe@gmail.com', |
100 | 99 | '[plainPassword]' => '123456', |
101 | | - '[agreeTerms]' => true |
| 100 | + '[agreeTerms]' => true, |
102 | 101 | ]); |
103 | 102 | $I->seeEvent(UserRegisteredEvent::class); |
104 | 103 | $I->seeEvent(KernelEvents::REQUEST, KernelEvents::FINISH_REQUEST); |
| 104 | + try { |
| 105 | + $I->seeEvent('non-existent-event'); |
| 106 | + } catch (ExpectationFailedException $ex) { |
| 107 | + $I->assertTrue(true, 'seeEvent assertion fails with non-existent events.'); |
| 108 | + return; |
| 109 | + } |
| 110 | + $I->fail('seeEvent assertion did not fail as expected'); |
105 | 111 | } |
106 | 112 | } |
0 commit comments