-
Notifications
You must be signed in to change notification settings - Fork 25
Added seeEventTriggered function #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/Codeception/Module/Symfony.php
Outdated
* @param string|object|string[] $expected | ||
* @param bool $orphan | ||
*/ | ||
public function seeEventTriggered($expected, bool $orphan = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the $orphan
parameter for? It isn't documented.
Using boolean flag parameters is considered to be a bad practice,
it would be better to introduce another method, e.g. seeOrphanedEventTriggered
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok.
Before making the changes and creating the new function, i would like to clarify something:
Using boolean flag parameters is considered to be a bad practice
To be consistent with this, do you agree to create specific functions for the following methods that already include parameter flags?:
public function persistService(string $serviceName, bool $isPermanent = false)
public function seeAuthentication(bool $remembered = false)
public function dontSeeAuthentication(bool $remembered = true)
Something like:
persistPermanentService
seeRememberedAuthentication
dontSeeRememberedAuthentication
If we know that it is a bad practice, it is something that we must correct, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Naktibalda One more thing.
Should the name be seeOrphanEventTriggered
or seeOrphanedEventTriggered
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be consistent with this, do you agree to create specific functions for the following methods that already include parameter flags?
Yes.
Should the name be seeOrphanEventTriggered or seeOrphanedEventTriggered ?
What is an orphaned event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is also not documented on Symfony.com but that is how it was named when it was added to the Profiler.
See symfony/symfony#24347 and symfony/symfony#24392
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically it is an event that fires without the need for a listener. Instead, it is executed by calling the ->dispatch()
method manually.
Edit: I removed the flag here as you requested.
It is also present in the Laravel module.
The symfony translation was a bit more complex, since there is no method to directly ask if an event was fired.
In any case, i was able to get the same behavior.