K
K
Kerm2020-07-29 16:19:02
symfony
Kerm, 2020-07-29 16:19:02

Is it possible in Symfony 3 when creating a test in Codeception to authorize a user, create a session?

I need to make an api test of the method, in which the user's rights are checked before the actions, could I somehow authorize in the test? My site uses sessions.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2020-07-29
@Kerm

You can make a fake authenticator

Symfony\Component\Security\Guard\AuthenticatorInterface

and slip a user with the necessary rights in a test environment, then you can easily check access rights You will need to make methods to control which user you want to imitate.
https://symfony.com/doc/current/security/form_logi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question