Skip to content

[Testing] Indicate how to use InMemoryUser in WebTestCase #21097

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
Jun 27, 2025

Conversation

peter17
Copy link
Contributor

@peter17 peter17 commented Jun 19, 2025

I lost a couple hours today to understand why with

$client->loginUser(new InMemoryUser('admin', 'password', ['ROLE_ADMIN']));

my request was not authenticated...

So I propose the following addition to the documentation.

Best regards

@javiereguiluz javiereguiluz merged commit 7671e7a into symfony:7.3 Jun 27, 2025
2 of 3 checks passed
@javiereguiluz
Copy link
Member

javiereguiluz commented Jun 27, 2025

Thanks Peter ... and congrats on your first Symfony Docs contribution 🎉

users:
admin: { password: password, roles: ROLE_ADMIN }
and then log the user with::
Copy link
Contributor

Choose a reason for hiding this comment

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

s/log/log in/? "logging" the user sounds more like writing the user into a log?

Copy link
Member

Choose a reason for hiding this comment

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

Yes ... but while merging we did a minor change to reverse the original order (instead of showing config first and then how to log in, we did the opposite) so we tweaked that.

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