Skip to content

Commit 2ab9c84

Browse files
committed
Merge branch '4.4' into 5.2
* 4.4: [Symfony CLI] Document about `APP_ENV=test` behavior
2 parents ffe66cb + 5529b12 commit 2ab9c84

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

setup/symfony_server.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,22 @@ prefixed with ``DB_``, but as the ``com.symfony.server.service-prefix`` is set
322322
to ``DATABASE``, the web server creates environment variables starting with
323323
``DATABASE_`` instead as expected by the default Symfony configuration.
324324

325+
You don't need to create two containers for the main database and the test
326+
database. Using ``APP_ENV=test symfony`` will automatically adjust
327+
``DATABASE_*`` environment variables for the ``test`` environment:
328+
329+
.. code-block:: terminal
330+
331+
$ symfony var:export --multiline
332+
export DATABASE_DATABASE=app
333+
export DATABASE_NAME=app
334+
export DATABASE_URL=postgres://app:app@127.0.0.1:49160/app?sslmode=disable&charset=utf8
335+
336+
$ APP_ENV=test symfony var:export --multiline
337+
export DATABASE_DATABASE=app_test
338+
export DATABASE_NAME=app_test
339+
export DATABASE_URL=postgres://app:app@127.0.0.1:49160/app_test?sslmode=disable&charset=utf8
340+
325341
Here is the list of supported services with their ports and default Symfony
326342
prefixes:
327343

0 commit comments

Comments
 (0)