Warning: You are browsing the documentation for Symfony 5.1, which is no longer maintained.

Read the updated version of this page for Symfony 5.3 (the current stable version).

How to Simulate HTTP Authentication in a Functional Test

How to Simulate HTTP Authentication in a Functional TestΒΆ

Caution

Starting from Symfony 5.1, a loginUser() method was introduced to ease testing secured applications. See Logging in Users (Authentication) for more information about this.

If you are still using an older version of Symfony, view previous versions of this article for information on how to simulate HTTP authentication.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.