Skip to content

Added logout by path #134

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 2 commits into from
Jun 7, 2021
Merged

Added logout by path #134

merged 2 commits into from
Jun 7, 2021

Conversation

TavoNiievez
Copy link
Member

@TavoNiievez TavoNiievez commented May 29, 2021

Now that a simpler interface for logging out is being discussed in Symfony, I think it's a good time to clarify that there are two ways to log out in a functional test.

One is by going the logout path,
and the other is by invalidating the session and expiring the cookies 'manually' or 'programmatically'.

@TavoNiievez TavoNiievez requested a review from Naktibalda May 29, 2021 21:56
@TavoNiievez
Copy link
Member Author

@ThomasLandauer

@TavoNiievez TavoNiievez merged commit cfb8c6c into Codeception:main Jun 7, 2021
@TavoNiievez TavoNiievez added this to the 2.0.4 milestone Jun 7, 2021
@ThomasLandauer
Copy link
Member

Sorry, I don't quite get the benefit here :-( If I want to test the app's logout feature, I certainly have to use your first method ($I->amOnPage('/logout')).

So what would be a use case for a programmatic logout in a test? If I wanted to proceed with a logged out (=not logged in) user, I'd just start a new test ;-)

@TavoNiievez
Copy link
Member Author

@ThomasLandauer you can have an event subscriber for the logout event. This would fire when accessing '/logout'. logoutProgramatically is a way to clean up that session from Codeception and not from Symfony as such.
Another advantage is that the /logout path is customizable. If you use $I->amOnPage you would have to edit the test in case that path changes.

@ThomasLandauer
Copy link
Member

Sorry, I still don't really see a use case :-(

logoutProgramatically is a way to clean up that session from Codeception and not from Symfony as such.

Yeah, but having Codeception and Symfony out of sync is a bad thing, isn't it?

Another advantage is that the /logout path is customizable. If you use $I->amOnPage you would have to edit the test in case that path changes.

Yeah, OK, but that's just how life is ;-) If you change the app, you have to adapt the tests.

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