Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Valorin's avatar

In memory database and PHPUnit

I'm playing around with an in-memory sqlite database for automatic unit testing when a file is saved, since it's a lot faster than using an sqlite file - and requires less resources than a full database install. However, it appears PHPUnit runs every test method inside each class within it's own memory allocation, so I need to run my migrations and my seeds before every test. When you start getting 100+ test cases, this takes a while.

I have processIsolation="false" set in the xml file, so there must be some magic behind the scenes. Does anyone know how to get it to work?

I'm using the default PHPUnit configuration that comes with Laravel, adding in artisan calls for migrate and seed.

0 likes
1 reply

Please or to participate in this conversation.