This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the testing category.
Last Updated: 2025-11-14
I wrote a Laravel dusk integration test
<? php
Mail::fake();
Mail::assertSent(ReverseAuctionMail::class, 3);
To run these tests I had to have a test server in one tab running php artisan
server and my dusk tests in another php artisan dusk.
However this mock never worked. The server process had no idea about it, having been started up independently (and often BEFORE the test script.)
Mocks/fakes etc. in testing will fail (in most systems) if your testing set-up involves two independently started processes. Therefore consider: