mirror of
https://ghproxy.net/https://github.com/fairpm/fair-plugin.git
synced 2026-08-09 13:40:26 +08:00
bin/run-integration.sh: full lifecycle runner with trap EXIT guarantee. Spins up Docker Compose ephemeral env (WP 6.4 + PHP 8.0 + MySQL + mock DID/repo server), installs WP, activates plugin, seeds data, runs PHPUnit integration tests, then tears EVERYTHING down (containers, volumes, networks) regardless of exit code. tests/mock-server/: PHP built-in server emulating PLC Directory and FAIR Repository APIs. Serves fixture JSON for DIDs and metadata. File-based request log for test assertions. Docker healthcheck. tests/sites/ephemeral/integration/: Docker Compose + Dockerfile.wp for WordPress + wp-cli + mock-server + MariaDB on shared network. Plugin code mounted via :delegated volume. tests/integration/: Bootstrap that loads WP directly (no test suite needed) + phpunit.xml + first integration test validating the full DID→document→metadata→release pipeline against the mock server. Production change: get_plc_client() now checks FAIR_PLC_DIRECTORY_URL constant for testability (defaults to plc.directory). 4 integration tests (3 pass, 1 skipped — log file permissions): - mock server health check - full DID resolution pipeline - mock server request logging (skipped) - unknown DID error handling Signed-off-by: Chuck Adams <chaz@chaz.works>
11 lines
320 B
Docker
11 lines
320 B
Docker
FROM php:8.0-cli-alpine
|
|
|
|
COPY tests/mock-server/index.php /app/index.php
|
|
COPY tests/fixtures/ /app/fixtures/
|
|
WORKDIR /app
|
|
EXPOSE 8080
|
|
|
|
HEALTHCHECK --interval=2s --timeout=3s --retries=15 \
|
|
CMD php -r "echo file_get_contents('http://localhost:8080/health');" | grep -q ok
|
|
|
|
CMD ["php", "-S", "0.0.0.0:8080", "index.php"]
|