Ian Phillips
Ian Phillips

Reputation: 2057

config_test.yml settings not appearing in debug:config

When I run

app/console --env=test debug:config security

I still see my production settings from security.yml, not my test settings from config_test.yml. Any idea why?

Upvotes: 0

Views: 81

Answers (1)

Ian Phillips
Ian Phillips

Reputation: 2057

It seems I had to recursively override every single item in my security config. For example, imagine my security.yml looks like this:

firewalls:
    firewall_a:
        pattern: ^/api
        complicated_oauth_security: {}
    firewall_b:
        pattern: ^/
        complicated_username_password_security: {}

And imagine for testing I want something that looks like this:

firewalls:
    only_one_firewall_for_everything:
        pattern: ^/
        http_basic: ~

The actual content of config_test.yml needs to look like this:

firewalls:
    firewall_a:
        # I can leave out "pattern", since that isn't changing.
        complicated_oauth_security: false
        http_basic: ~
    firewall_b:
        complicated_username_password_security: false
        http_basic: ~

I thought that re-declaring a firewall in config_test.yml would replace the entire thing, but that's not how it works. You must override each individual item that you want to change.

Upvotes: 1

Related Questions