Cover of the book Symfony 5: The Fast Track

Symfony 5: The Fast Track is the best book to learn modern Symfony development, from zero to production. +300 pages in full color showing how to combine Symfony with Docker, APIs, queues & async tasks, Webpack, Single-Page Applications, etc.

Buy printed version

How to Simulate HTTP Authentication in a Functional Test

5.1 version

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.