Skip to content

Latest commit

 

History

History
71 lines (47 loc) · 1.79 KB

File metadata and controls

71 lines (47 loc) · 1.79 KB

PostgreSQL Integration Tests

This directory contains integration tests that run against a real PostgreSQL database with PostGIS extensions. These tests validate that our custom DBAL types work correctly with an actual PostgreSQL instance, including PostGIS geometry and geography types.

Running Tests Locally

Prerequisites

  • Docker (for running PostgreSQL with PostGIS)
  • PHP 8.2+ with the pdo_pgsql extension

Start PostgreSQL with PostGIS

You can use Docker Compose to start PostgreSQL with PostGIS:

# Start PostgreSQL with PostGIS using Docker Compose
docker-compose up -d

Or use a plain Docker command:

docker run --name postgres-doctrine-test -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=postgres_doctrine_test -p 5432:5432 -d postgis/postgis:18-3.6-alpine

Run the Tests

# Install the latest dependencies
composer update
# Run the integration tests
composer run-integration-tests

Environment Variables

The tests use the following environment variables which can be customized:

  • POSTGRES_HOST (default: localhost)
  • POSTGRES_PORT (default: 5432)
  • POSTGRES_DB (default: postgres_doctrine_test)
  • POSTGRES_USER (default: postgres)
  • POSTGRES_PASSWORD (default: postgres)

You can set these variables before running the tests:

POSTGRES_HOST=custom-host POSTGRES_PORT=5433 composer run-integration-tests

Cleanup

If you used Docker Compose:

docker-compose down -v

If you used plain Docker:

docker stop postgres-doctrine-test
docker rm postgres-doctrine-test

CI Integration

These tests are automatically run in GitHub Actions against PostgreSQL 16, 17 & 18 with PostGIS for all supported PHP versions.

The workflow is defined in .github/workflows/integration-tests.yml.