Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 1 commit into from
Dec 11, 2020
Merged

Added seeEventTriggered function #68

merged 1 commit into from
Dec 11, 2020

Conversation

TavoNiievez
Copy link
Member

@TavoNiievez TavoNiievez commented Dec 9, 2020

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.

@TavoNiievez TavoNiievez added this to the 1.5.0 milestone Dec 9, 2020
@TavoNiievez TavoNiievez mentioned this pull request Dec 9, 2020
11 tasks
* @param string|object|string[] $expected
* @param bool $orphan
*/
public function seeEventTriggered($expected, bool $orphan = false)
Copy link
Member

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.

Copy link
Member Author

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?

Copy link
Member Author

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 ?

Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

@TavoNiievez TavoNiievez Dec 9, 2020

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.

@TavoNiievez TavoNiievez merged commit 33aa68c into Codeception:master Dec 11, 2020
@TavoNiievez TavoNiievez deleted the seeEventTriggered branch December 11, 2020 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants