@@ -26,7 +26,7 @@ default:
26
26
# # PHP runtime ##
27
27
28
28
# start PHP built-in webserver
29
- start : config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php
29
+ start : config/components-dev.local.php backend/config/cookie-validation.key env.php
30
30
@echo " Starting server for api"
31
31
cd api && $(MAKE ) start
32
32
@echo " Starting server for backend"
@@ -45,7 +45,7 @@ bash: cli
45
45
cli :
46
46
$(DOCKER ) bash
47
47
48
- start-docker : docker-compose.override.yml runtime/build-docker config/components-dev.local.php config/components-test.local.php backend/config/cookie-validation.key env.php stop
48
+ start-docker : docker-compose.override.yml runtime/build-docker config/components-dev.local.php backend/config/cookie-validation.key env.php stop
49
49
docker-compose up -d
50
50
docker-compose exec -T backend-php bash -c " grep '^$( shell whoami) :' /etc/passwd || useradd -m '$( shell whoami) ' --uid=$( shell id -u) -G www-data -s /bin/bash -d /app/runtime/home"
51
51
docker-compose exec -T backend-php bash -c " sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/' /app/runtime/home/.bashrc && sed -i 's~etc/bash_completion~etc/bash_completion.d/yii~' /app/runtime/home/.bashrc"
@@ -74,3 +74,19 @@ docker-compose.override.yml: docker-compose.override.dist.yml
74
74
test -f $@ || cp $< $@
75
75
backend/config/cookie-validation.key :
76
76
test -s $@ || php -r ' echo bin2hex(random_bytes(20));' > $@
77
+
78
+
79
+ # # Docker Runtime Tests ##
80
+
81
+ test : tests/_data/dump.sql
82
+ $(DOCKER ) vendor/bin/codecept run
83
+
84
+ clean :
85
+ rm -rf tests/_data/dump.sql
86
+
87
+ # generate database dump for test env
88
+ tests/_data/dump.sql : $(shell find common/migrations -type f)
89
+ $(DOCKER ) sh -c ' YII_ENV=test ./yii migrate/fresh --interactive=0'
90
+ $(DOCKER ) sh -c ' mysqldump -h db-test -uapi_test -papisecret api_db_test > tests/_data/dump.sql'
91
+ # for postgres you may use this command instead:
92
+ # $(DOCKER) sh -c 'PGPASSWORD=apisecret pg_dump --schema-only --clean --if-exists -w -h db-test -U api_test -d api_db_test -f tests/_data/dump.sql'
0 commit comments