new: pkg: add test cases to back-end w/ real database connection in it #10
This commit is contained in:
23
Makefile
23
Makefile
@@ -1,4 +1,4 @@
|
||||
.PHONY: help start start-build stop build down ps logs prune-everything db-reset mercure-jwt cache-clear og-cache-clear
|
||||
.PHONY: help start start-build stop build down ps logs prune-everything db-reset mercure-jwt cache-clear og-cache-clear test-db-setup test-db-reset test
|
||||
|
||||
.DEFAULT_GOAL := help
|
||||
|
||||
@@ -14,6 +14,9 @@ help:
|
||||
@echo " make ccp - Clear the production cache"
|
||||
@echo " make cache-clear - Clear all caches (Vite, Symfony, node_modules)"
|
||||
@echo " make og-cache-clear - Clear Open Graph cache only"
|
||||
@echo " make test-db-setup - One-time setup: Create test database and run migrations"
|
||||
@echo " make test-db-reset - Reset test database (drop, create, migrate)"
|
||||
@echo " make test - Run PHPUnit tests"
|
||||
|
||||
start:
|
||||
docker compose up -d
|
||||
@@ -80,5 +83,23 @@ og-cache-clear:
|
||||
@echo "✓ OG cache cleared!"
|
||||
@echo " Battle card images will be regenerated on next access"
|
||||
|
||||
test-db-setup:
|
||||
@echo "Setting up test database..."
|
||||
@bin/console dbal:run-sql "SELECT 1 FROM pg_database WHERE datname='mineseeker_test'" 2>/dev/null | grep -q 1 || \
|
||||
(bin/console dbal:run-sql "CREATE DATABASE mineseeker_test" && echo "✓ Database 'mineseeker_test' created")
|
||||
@bin/console doctrine:migrations:migrate --env=test --no-interaction --allow-no-migration 2>&1 | grep -v "WARNING" || true
|
||||
@echo "✓ Test database setup complete!"
|
||||
@echo " Database: mineseeker_test"
|
||||
@echo " Run tests with: make test"
|
||||
|
||||
test-db-reset:
|
||||
@echo "Resetting test database..."
|
||||
@bin/console dbal:run-sql "DROP DATABASE IF EXISTS mineseeker_test" --quiet
|
||||
@bin/console dbal:run-sql "CREATE DATABASE mineseeker_test" --quiet
|
||||
@bin/console doctrine:migrations:migrate --env=test --no-interaction --quiet
|
||||
@echo "✓ Test database reset complete!"
|
||||
@echo " Database: mineseeker_test"
|
||||
@echo " Run tests with: make test"
|
||||
|
||||
test:
|
||||
@php -d memory_limit=512M bin/phpunit --testdox --colors=always
|
||||
|
||||
Reference in New Issue
Block a user