PHPUnit ends without errors

Published on Feb 24, 2025

I had a weird issue the other day that PHPUnit for one of my WordPress plugins didn't seem to run at all, yet no errors yielded, and ChatGPT said everything was setting correctly.

So I googled about it. (Yes it's been a while since last time I googled for a coding related problem.) And something from Stackoverflow caught my attention immediately.

It turns out it's a Composer package I use exits early so nothing is actually running when I run my unit tests.

While checking out the repo of the said package to confirm such an issue exists, the solution I use at the moment is to exclude that file from Composer's autload files and manually require it in the codebase. So the plugin can be tested correctly.

It led me to this interesting Composer plugin. And I hope it can also help someone who's googling for such problems :)