E
E
EVOSandru62018-11-18 01:08:03
Laravel
EVOSandru6, 2018-11-18 01:08:03

Why does migration to laravel on a test environment go to the main database?

Hi guys. tell me why the migration goes to the main database?
php artisan migrate --env=testing
phpunit.xml:

...
<php>
        <env name="APP_ENV" value="testing"/>
        ... 
</php>

.env.testing:
APP_NAME=Laravel
APP_ENV=test
APP_KEY=base64:dQemaYMaXL/RiRNJ3LVte/yHCxwCSCyCxHfidQ9JH7A=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=db_test
DB_USERNAME=postgres
DB_PASSWORD=postgres

What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Tolmachev, 2018-11-18
@EVOSandru6

Check how it works for you:
1. artisan --env=testing migrate

artisan help
Usage:
[options] command [arguments]
I did some digging, earlier this topic was brought up in a 5.2 turnip that the environment setup keys do not work ( Proof ), but Taylor rejected the edits, as far as I understood. Maybe the situation has changed recently, I have a separate test separately, so I did not encounter such a problem.
2. Create a separate connection to the database in the database configs
https://laracasts.com/discuss/channels/testing/set...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question