H
H
HellWalk2020-03-03 16:52:21
symfony
HellWalk, 2020-03-03 16:52:21

Why doesn't disabling csrf_protection via config in Symfony work?

For acceptance tests, you need to disable csrf protection at the site level (not through the container, as you can do in unit tests).

The official documentation says that this can be done.

So, I specify in codeception.yml:

params:
    - .env.test.local


In .env.test.local:
APP_ENV=test

In config/packages/test/framework.yaml:
framework:
    test: true
    session:
        storage_id: session.storage.mock_file
    csrf_protection:
        enabled: false


I'm running tests on the form and I see an error:
The CSRF token is invalid. Please try to resubmit the form.


Why didn't csrf_protection turn off?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question