fr
fr

Question from the Symfony 6 test

How to use URLs in a functional test in Symfony

Hard

According to the best pratices, what is the recommended way to use URLs in a functional test?

Author: Thomas CochardStatus: PublishedQuestion passed 1114 times
Edit
4
Community Evaluations
developer avatar
David
08/02/2024
Il faut utiliser le générateur d'url, quoi d'autres ?
developer avatar
Auteur anonyme
12/02/2024
Il a mentionné que cette réponse est fausse XD
developer avatar
David
18/02/2024
justement, pourquoi ? XD
developer avatar
Thomas Cochard
01/03/2024
La documentation officielle de Symfony indique : Hardcoding the request URLs is a best practice for application tests. If the test generates URLs using the Symfony router, it won't detect any change made to the application URLs which may impact the end users. https://symfony.com/doc/current/testing.html
developer avatar
Incorrect answer
Auteur anonyme
28/11/2024
The correct answer is: Use a URL generator
developer avatar
Thomas Cochard
16/02/2025
Official Symfony documentation actually says : ardcoding the request URLs is a best practice for application tests. If the test generates URLs using the Symfony router, it won't detect any change made to the application URLs which may impact the end users. https://symfony.com/doc/current/testing.html