-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
seeEvent fails with non-existent events.
- Loading branch information
1 parent
6398d45
commit 45b6076
Showing
1 changed file
with
11 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
use App\Event\UserRegisteredEvent; | ||
use App\Tests\FunctionalTester; | ||
use PHPUnit\Framework\ExpectationFailedException; | ||
use Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector; | ||
use Symfony\Component\Console\ConsoleEvents; | ||
use Symfony\Component\Console\EventListener\ErrorListener; | ||
|
@@ -43,14 +44,13 @@ public function dontSeeOrphanEvent(FunctionalTester $I) | |
$I->submitForm('form[name=login]', [ | ||
'email' => '[email protected]', | ||
'password' => '123456', | ||
'_remember_me' => false | ||
'_remember_me' => false, | ||
]); | ||
$I->dontSeeOrphanEvent(); | ||
} | ||
|
||
public function dontSeeEvent(FunctionalTester $I) | ||
{ | ||
$I->markTestSkipped(); | ||
$I->amOnPage('/'); | ||
$I->dontSeeEvent(KernelEvents::EXCEPTION); | ||
$I->dontSeeEvent([new UserRegisteredEvent(), ConsoleEvents::COMMAND]); | ||
|
@@ -85,22 +85,28 @@ public function seeOrphanEvent(FunctionalTester $I) | |
$I->submitSymfonyForm('registration_form', [ | ||
'[email]' => '[email protected]', | ||
'[plainPassword]' => '123456', | ||
'[agreeTerms]' => true | ||
'[agreeTerms]' => true, | ||
]); | ||
$I->seeOrphanEvent(UserRegisteredEvent::class); | ||
} | ||
|
||
public function seeEvent(FunctionalTester $I) | ||
{ | ||
$I->markTestSkipped(); | ||
$I->amOnPage('/register'); | ||
$I->stopFollowingRedirects(); | ||
$I->submitSymfonyForm('registration_form', [ | ||
'[email]' => '[email protected]', | ||
'[plainPassword]' => '123456', | ||
'[agreeTerms]' => true | ||
'[agreeTerms]' => true, | ||
]); | ||
$I->seeEvent(UserRegisteredEvent::class); | ||
$I->seeEvent(KernelEvents::REQUEST, KernelEvents::FINISH_REQUEST); | ||
try { | ||
$I->seeEvent('non-existent-event'); | ||
} catch (ExpectationFailedException $ex) { | ||
$I->assertTrue(true, 'seeEvent assertion fails with non-existent events.'); | ||
return; | ||
} | ||
$I->fail('seeEvent assertion did not fail as expected'); | ||
} | ||
} |