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

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners