Skip to main content

Operations and testing

Deployment setup

Run schema setup during deployment:

$schema = new MongoDbSchemaManager($database);
$schema->ensureSchema();

ensureSchema() is idempotent. It creates the event, snapshot-history, and process-manager indexes defined by the adapter. The application user can then run without schema-creation privileges when all required indexes already exist.

Local MongoDB

The adapter repository includes a Docker Compose setup for a single-node replica set, which is the required shape for transaction-path integration tests:

docker compose up -d
composer install
composer test-all

The integration setup reads MONGO_URI and MONGO_DB; its defaults are mongodb://127.0.0.1:27017 and event_sourcing_test.

The package also ships reusable Core contract tests. Adapter-specific tests cover BSON documents, indexes, transactions, the explicitly opt-in standalone fallback, snapshots, process-manager state, concurrency, and outbox behavior.

Quality checks

composer quality

This runs Composer validation, coding-style checks, PHPStan, the complete test suite with coverage enforcement, and Composer audit.