Answer the question
In order to leave comments, you need to log in
What is the correct way to spill fixtures in a test environment inside a Docker container in symfony doctrine?
Hey guys.
Please tell me - how to pass the environment variable when starting the Docker container?
My task is to load the fixtures before running the test.
The offdoc contains the following construct for the Makefile for this task:
https://symfony.com/doc/current/the-fast-track/en/...
SHELL := /bin/bash
tests: export APP_ENV=test
tests:
symfony console doctrine:database:drop --force || true
symfony console doctrine:database:create
symfony console doctrine:migrations:migrate -n
symfony console doctrine:fixtures:load -n
symfony php bin/phpunit [email protected]
.PHONY: tests
SHELL := /bin/bash
tests: export APP_ENV=test
tests:
docker-compose run --rm manager-php-cli bin/console doctrine:database:drop --force || true
docker-compose run --rm manager-php-cli bin/console doctrine:database:create
docker-compose run --rm manager-php-cli bin/console doctrine:migrations:migrate -n
docker-compose run --rm manager-php-cli bin/console doctrine:fixtures:load -n
docker-compose run --rm manager-php-cli php bin/phpunit [email protected]
.PHONY: tests
DATABASE_URL=pgsql://app:[email protected]:5432/app
manager-postgres:
image: postgres:13.3-alpine
volumes:
- manager-postgres:/var/lib/postgresql/data
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: secret
POSTGRES_DB: app
ports:
- 54321:5432
# тестовая база
manager-postgres-test:
image: postgres:13.3-alpine
volumes:
- manager-postgres-test:/var/lib/postgresql/data
environment:
POSTGRES_USER: app
POSTGRES_PASSWORD: secret
POSTGRES_DB: app_test
ports:
- 54322:5432
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question