Description
As explained in different blog posts (here, here), and also in the docs - default password hasher (auto
) consumes a lot of resources and takes too much time, especially when it's executed thousands of times in functional tests.
From https://symfony.com/doc/current/security/passwords.html#configuring-a-password-hasher
Hashing passwords is resource intensive and takes time in order to generate secure password hashes. In general, this makes your password hashing more secure.
In tests however, secure hashes are not important, so you can change the password hasher configuration in test environment to run tests faster:
# config/packages/test/security.yaml
password_hashers:
# Use your user class name here
App\Entity\User:
algorithm: plaintext
So, what do you think to update an official recipe and in addition to config/packages/security.yaml
add one more file - config/packages/test/security.yaml
with the code above?
This will help many developers creating new projects to not waste time with functional tests.
Related to
- docs: Add information about how to significantly improve the test suite api-platform/docs#1472
- https://maks-rafalko.github.io/blog/2021-11-21/symfony-tests-performance/#using-more-simple-password-hasher
Thank you.