Run Perpl tests with Docker.
Mount your Perpl directory into a PHP container and run static analysis, linters, or tests, typically using another container running MySql or Postgres.
Checkout repository and cd into directory.
Communication between host and container is configured through environment variables:
| Variable | Description |
|---|---|
PERPL_HOME |
Path to Perpl repo, will be mounted at same location in the container and set as workdir. |
HOST_IP |
IP address of host for XDebug |
Note: When running Docker in rootless mode, host is accessed from container using host's external network IP:
HOST_IP=$(hostname -I | cut -d ' ' -f1) docker compose ...When host's external network IP changes, restart the container.
- run with MySql:
docker compose -f docker-compose-mysql.yml -f docker-compose-php.yml up- run with Postgres:
docker compose -f docker-compose-postgres.yml -f docker-compose-php.yml up- run with both Postgres & MySql:
docker compose -f docker-compose-postgres.yml -f docker-compose-mysql.yml -f docker-compose-php.yml updocker exec -it propel-test-php /bin/bashNote that composer libraries and test schema classes are installed into the Perpl folder mounted from host, same as running the commands directly in host.
- install dependencies
composer update- setup database and build fixtures
init-mysql
init-postgres
init-sqlite
testagnostic
testmysql
testpostgres
testsqlitestan
psalm
lint-clean
lint- on edited files only (
git addnew files before running)
stan-edited
lint-clean-edited
lint-edited
To find out about other aliases, enter aliases or check /root/bash_aliases
Example configuration (VSCode, Docker in rootless mode):
"configurations": [
{
"name": "...",
"type": "php",
"request": "launch",
"port": 9003,
"hostname": "0.0.0.0",
},Developed on Linux with rootless docker. If you run into issues or find this documentation could have made things easier, please open an issue or create a PR.