@@ -9,30 +9,29 @@ This could become an issue especially when the tests reproduce the same steps
9
9
that users follow to authenticate, such as submitting a login form or using
10
10
OAuth authentication services.
11
11
12
- This article explains the two most popular techniques to avoid these issues and
13
- create fast tests when using authentication.
12
+ This article explains some of the most popular techniques to avoid these issues
13
+ and create fast tests when using authentication.
14
14
15
- Improving Password Encoder Speed in Tests
16
- -----------------------------------------
15
+ Hashing Passwords Faster Only for Tests
16
+ ---------------------------------------
17
17
18
- By default, password encoders are resource intensive and take time. This is
19
- important to generate secure password hashes. In tests however, secure hashes
20
- are not important, waste resources and increase test times. You can reduce
21
- the *work factor * for your encoders by adding the following *only in your test
22
- environment *:
18
+ By default, :ref: `password encoders <security-encoding-user-password >` are
19
+ resource intensive and take time. This is important to generate secure password
20
+ hashes. In tests however, secure hashes are not important, so you can change the
21
+ encoders configuration to generate password hashes as fast as possible:
23
22
24
23
.. configuration-block ::
25
24
26
25
.. code-block :: yaml
27
26
28
27
# config/packages/test/security.yaml
29
28
encoders :
30
- # Use your user class name here
31
- App\Entity\User :
32
- algorithm : auto # This should be the same value as in config/packages/security.yaml
33
- cost : 4 # Lowest possible value for bcrypt
34
- time_cost : 3 # Lowest possible value for argon
35
- memory_cost : 10 # Lowest possible value for argon
29
+ # Use your user class name here
30
+ App\Entity\User :
31
+ algorithm : auto # This should be the same value as in config/packages/security.yaml
32
+ cost : 4 # Lowest possible value for bcrypt
33
+ time_cost : 3 # Lowest possible value for argon
34
+ memory_cost : 10 # Lowest possible value for argon
36
35
37
36
.. code-block :: xml
38
37
0 commit comments