This project provides a Docker Compose setup so developers can quickly spin up all external services required for testing.
| Service | Image | Default Port |
|---|---|---|
| MySQL 8.4 | mysql:8.4 |
3306 |
| PostgreSQL 17 | postgres:17-alpine |
5432 |
| Redis 7 | redis:7-alpine |
6379 |
| Memcached 1 | memcached:1-alpine |
11211 |
docker compose up -ddocker compose psCopy phpunit.xml.dist to phpunit.xml, then uncomment the DSN constants you need:
cp phpunit.xml.dist phpunit.xmlEdit phpunit.xml and uncomment the relevant <const> and <env> entries, for example:
<!-- MySQL (Docker) -->
<const name="WINDWALKER_TEST_DB_DSN_MYSQL"
value="host=127.0.0.1;dbname=windwalker_test;user=root;password=ut1234;prefix=ww_" />
<!-- PostgreSQL (Docker) -->
<const name="WINDWALKER_TEST_DB_DSN_POSTGRESQL"
value="host=127.0.0.1;dbname=windwalker_test;user=postgres;password=ut1234;prefix=ww_" />
<!-- SQLite (no extra service needed) -->
<const name="WINDWALKER_TEST_DB_DSN_SQLITE" value="dbname=tmp/test.db;prefix=ww_" />
<!-- Enable Redis / Memcached tests -->
<env name="REDIS_ENABLED" value="1" />
<env name="MEMCACHED_ENABLED" value="1" />php vendor/bin/phpunitIf you already have services installed locally (e.g. MySQL, Redis) and the default ports conflict, you have two options:
Copy and edit .env.docker:
cp .env.docker .envUncomment and change the port(s) you need:
MYSQL_PORT=3307
REDIS_PORT=6380Then update the DSN in phpunit.xml to use the new port, e.g. host=127.0.0.1;port=3307;....
Copy the override template and edit it:
cp docker-compose.override.yml.dist docker-compose.override.ymlInside the override file you can remap ports or remove a service entirely so that phpunit.xml connects to your locally installed service instead.
# Stop containers, keep data volumes
docker compose stop
# Stop and remove containers (data volumes are preserved)
docker compose down
# Stop and remove everything including data volumes
docker compose down -v| Service | Host | Port | User | Password | Database |
|---|---|---|---|---|---|
| MySQL | 127.0.0.1 | 3306 | root | ut1234 | windwalker_test |
| PostgreSQL | 127.0.0.1 | 5432 | postgres | ut1234 | windwalker_test |
| Redis | 127.0.0.1 | 6379 | — | — | — |
| Memcached | 127.0.0.1 | 11211 | — | — | — |