2024-09-21 11:00:33 +02:00
|
|
|
version: '3'
|
2024-09-21 14:59:26 +02:00
|
|
|
|
|
|
|
# This files purpose is to run the PHPunit tests locally.
|
2024-09-21 15:04:06 +02:00
|
|
|
# Install docker and docker compose and than just run:
|
|
|
|
# docker compose up
|
2024-09-21 14:59:26 +02:00
|
|
|
|
2024-09-24 16:24:31 +02:00
|
|
|
# To live debug in VSCode add this launch configuration to your .vscode/launch.json.
|
|
|
|
# It assumes that the WordPress root-dir is your workspace root.
|
|
|
|
#
|
|
|
|
# {
|
|
|
|
# "name": "Listen for PHPUnit",
|
|
|
|
# "type": "php",
|
|
|
|
# "request": "launch",
|
|
|
|
# "port": 9003,
|
|
|
|
# "pathMappings": {
|
|
|
|
# "/app/": "${workspaceRoot}/wp-content/plugins/activitypub-event-extensions/",
|
|
|
|
# "/tmp/wordpress/": "${workspaceRoot}/"
|
|
|
|
# },
|
|
|
|
# },
|
|
|
|
|
2024-09-21 11:00:33 +02:00
|
|
|
services:
|
|
|
|
test-db:
|
|
|
|
image: mariadb
|
|
|
|
environment:
|
2024-09-21 14:59:26 +02:00
|
|
|
MARIADB_DATABASE: wordpress-test
|
|
|
|
MARIADB_ROOT_PASSWORD: wordpress-test
|
2024-09-21 11:00:33 +02:00
|
|
|
healthcheck:
|
2024-09-21 14:59:26 +02:00
|
|
|
test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
|
2024-09-25 11:27:17 +02:00
|
|
|
start_period: 2s
|
|
|
|
interval: 1s
|
2024-09-21 14:59:26 +02:00
|
|
|
timeout: 5s
|
2024-09-25 11:27:17 +02:00
|
|
|
retries: 10
|
2024-09-21 11:00:33 +02:00
|
|
|
|
|
|
|
test-php:
|
|
|
|
build:
|
|
|
|
context: .
|
|
|
|
dockerfile: Dockerfile
|
|
|
|
depends_on:
|
|
|
|
test-db:
|
|
|
|
condition: service_healthy
|
|
|
|
links:
|
|
|
|
- test-db
|
|
|
|
volumes:
|
|
|
|
- .:/app
|
2024-09-25 11:27:17 +02:00
|
|
|
command: ["composer", "run-script", "test-debug"]
|
2024-09-24 16:24:31 +02:00
|
|
|
extra_hosts:
|
|
|
|
- "host.docker.internal:host-gateway"
|