Fix PHPUnit Not Doing Anything
Are you trying to run PHPUnit, but it just exits without doing anything? Hopefully, I think I may have an answer for you.
For me, a vanilla installation of PHP with PHPUnit will do nothing if one of your scripts cannot be parsed by PHP. You would never know this because the default INI configuration for PHP hides those errors. To know for sure, you should check the exit status after running PHPUnit.
kherrera@dev:~/git/myProject$ phpunit
kherrera@dev:~/git/myProject$ echo $?
254
The exit status may be different from yours, but it cannot be zero if it’s the problem I think it is. To fix this, you need to change the display_errors and error_reporting INI settings for your CLI PHP installation. Your settings should look something like this, just make sure you don’t do this on a production machine:
display_errors = stderr
error_reporting = E_ALL
Now when you run PHPUnit, you should see something like this:
kherrera@dev:~/git/myProject$ phpunit
PHP Fatal error: Call to undefined function badTaco() in /home/kherrera/badtaco.php on line 3
PHP Stack trace:
PHP 1. {main}() /home/kherrera/badtaco.php:0
Fatal error: Call to undefined function badTaco() in /home/kherrera/badtaco.php on line 3
Call Stack:
0.0001 317568 1. {main}() /home/kherrera/badtaco.php:0
The output will be different for you, but at least you now know why PHPUnit isn’t running. Once you fix the bugs causing the error(s), you should be able to run PHPUnit without a problem.