Test environment
Current version — This documentation describes the current major version of doctrine-spatial.
Doctrine Spatial is tested against MySQL, MariaDB, PostgreSQL/PostGIS, and SQL Server. The local development environment uses Docker Compose.
Prepare the environment
- Install Docker.
- From the project root, set
APP_FOLDERto the absolute path of the checkout and start the services:
export APP_FOLDER="$(pwd)"
cd docker
docker-compose up -d
cd ..
The Compose stack starts six services:
- PostgreSQL/PostGIS, available at
postgresql://main:main@127.0.0.1:5432/main; - MySQL 8.4, available at
mysql://main:main@127.0.0.1:3306/main; - MariaDB (the current
latestimage), available atmysql://main:main@127.0.0.1:3310/main; - SQL Server 2017, available at
127.0.0.1:1433; - PHP 8.4, available through the
spatial-php8container; - the Sphinx documentation server, available at
http://127.0.0.1:8800.
Install dependencies and prepare PHPUnit
Composer is available in the PHP container. Install the project dependencies and copy the Docker PHPUnit configurations to the project root:
docker exec spatial-php8 composer install
cp docker/phpunit.*.xml .
The copied configurations use Docker service host names and must be run from the PHP container.
Run tests
Run an individual database suite, the PHP-only suite, or the complete test suite:
docker exec spatial-php8 composer test-mariadb
docker exec spatial-php8 composer test-mysql
docker exec spatial-php8 composer test-pgsql
docker exec spatial-php8 composer test-sqlserver
docker exec spatial-php8 composer test-php-only
docker exec spatial-php8 composer test
To generate and merge coverage reports, run:
docker exec spatial-php8 composer test-coverage
Check code quality
Before committing, run the configured quality checks:
docker exec spatial-php8 composer quality
This command runs PHP-CS-Fixer, PHPStan, PHPMD, and PHP_CodeSniffer. PHP-CS-Fixer may modify files.