How to solve PHPUnit exiting without errors
This blog post was originally published a little while ago. Please consider that it may no longer be relevant or even accurate.
I've been getting into testing a little bit recently, and after writing about 30 tests or so, found that running phpunit would run a bunch of tests, then just silently quit. No error messages or anything, there'd just be a string of .'s representing the tests, then back to the prompt. For me, this turned to be an issue with PHP's memory limit being hit.
I solved the problem using PHP's display_errors and memory_limit settings, which you could adjust in your development php.ini if you like, but I've opted to use it on the command line. If you've got PHPUnit installed through Composer, try this:
Now, when you run PHPUnit instead of it silently failing you should get an error. In my case, it was something like this:
Pretty much just hit the memory limit. Again, easily fixed with a flag:
I ended up just aliasing phpunit to run the above command for me, though I could just have easily changed those two options for PHP globally. Feel free to do whatever feels more right to you, but at least this will get PHPUnit back up and running!
