-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Security][Guard] check if session exist before using it #19218
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3e8c68d
check if session exist before using it
pasdeloup 473bb7f
fix CS on old code according to fabbot.io
pasdeloup 4f1d0db
added tests
pasdeloup 164d327
fix CS according to fabbot.io
pasdeloup 30d1d7d
Move Mock class at the send of the test class
pasdeloup e0f4924
initialize targetPath to null
pasdeloup bf7e3e4
improve test lisibility and add case where targetPath is set or not i…
pasdeloup 15e3f06
fix CS: remove useless spaces
pasdeloup 43b9194
rename tested class to TestFormLoginAuthenticator
pasdeloup File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Move Mock class at the send of the test class
- Loading branch information
commit 30d1d7d66b1347dcbba4d989e183a772df7b4ec4
There are no files selected for viewing
This file contains hidden or 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
90 changes: 0 additions & 90 deletions
90
src/Symfony/Component/Security/Guard/Tests/Authenticator/MockFormLoginAuthenticator.php
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
I think we usually name these
TestFormLoginAuthenticator
, because that's what you test, isn't it? (not a dep you mock)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.
Actually, just using
FormLoginAuthenticator
as class name would fit here too.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.
You're right, it's not a Mock as it's what is tested, and that's why I didn't like the idea of using a PHPUnit mock either.
I checked in the code to be consistent with existing code for abstract class testings and found 2 main ways of doing it (and a few mixes) :
FormLoginAuthenticatorTest
Tested concrete class is defined after the test and named
TestFormLoginAuthenticator
AbstractFormLoginAuthenticatorTest
Tested concrete class is defined before the test and named
ConcreteFormLoginAuthenticator
I pushed a version using the 1st way as it seems the more common.