8000 [Security] simplify the SwitchUserListenerTest by xabbuh · Pull Request #22049 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] simplify the SwitchUserListenerTest #22049

New i 8000 ssue

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
Mar 22, 2017

Conversation

xabbuh
Copy link
Member
@xabbuh xabbuh commented Mar 17, 2017
Q A
Branch? 2.7
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

While working on #22048 I noticed that the SwitchUserListenerTest was more complicated than necessary by mocking a lot of stuff that didn't need to be mocked.

Copy link
Contributor
@GuilhemN GuilhemN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Except my question, 👍


$this->tokenStorage->expects($this->any())->method('getToken')->will($this->returnValue($token));
$this->request->expects($this->any())->method('get')->with('_switch_user')->will($this->returnValue('kuba'));
$this->request->query->expects($this->once())->method('remove', '_switch_user');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this missing in the new test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check later on that the query parameter bag is empty.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok i missed that 👍

@fabpot
Copy link
Member
fabpot commented Mar 22, 2017

Thank you @xabbuh.

@fabpot fabpot merged commit 923bbdb into symfony:2.7 Mar 22, 2017
fabpot added a commit that referenced this pull request Mar 22, 2017
This PR was merged into the 2.7 branch.

Discussion
----------

[Security] simplify the SwitchUserListenerTest

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
| Doc PR        |

While working on #22048 I noticed that the `SwitchUserListenerTest` was more complicated than necessary by mocking a lot of stuff that didn't need to be mocked.

Commits
-------

923bbdb [Security] simplify the SwitchUserListenerTest
@xabbuh xabbuh deleted the simplify-tests branch March 23, 2017 07:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0