Skip to content

Application use a production database in a test environment. #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
voronkovich opened this issue May 2, 2017 · 3 comments
Closed

Application use a production database in a test environment. #556

voronkovich opened this issue May 2, 2017 · 3 comments

Comments

@voronkovich
Copy link
Contributor

https://github.com/symfony/symfony-demo/blob/master/app/config/config.yml#L65

# config.yml
doctrine:
    dbal:
        url: "%env(DATABASE_URL)%"

https://github.com/symfony/symfony-demo/blob/master/app/config/config_test.yml#L24

# config_test.yml
doctrine:
    dbal:
        # It doesn't override an "url" value!
        path: "%kernel.root_dir%/../var/data/blog_test.sqlite"
@hacfi
Copy link

hacfi commented May 2, 2017

@voronkovich Try url: sqlite:%kernel.root_dir%/../var/data/blog_test.sqlite and then run
bin/console debug:config doctrine -e=test to see if this value is showing up.

As you can see here https://github.com/doctrine/DoctrineBundle/blob/master/DependencyInjection/Configuration.php#L201 url: any parameter value parsed from this string will override explicitly set parameters

@stof
Copy link
Member

stof commented May 3, 2017

if you define both the URL and the path in your config, the URL wins in Doctrine DBAL. So you would have to overwrite it using the URL in config_test.yml

@dmaicher
Copy link
Contributor

@javiereguiluz this can be close since you fixed it in #572 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants