It's very common in the Laravel community to use SQLite in-memory for phpunit tests. However, sometimes you may need functionality that differ between MySQL and SQLite. Not writing test for that or struggling to find a compatible SQL operation for the two databases are options that I consider less than ideal. We can instruct Docker to mount a file system that will only be persisted on memory database: image: mysql:5.7 ports: - "3306:3306" environment: - MYSQL_DATABASE={your_default_database} tmpfs: - /var/lib/mysql:rw Setting up /var/lib/mysql as a read-write temporary file system will instruct docker to skip the local storage and only mount the volume in memory, speeding up it's storage manipulation.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners