PHPUnit problem - no error messages PHPUnit problem - no error messages symfony symfony

PHPUnit problem - no error messages


OK, so if anyone has trouble with getting none or incomplete output from PHPUnit command line, double-check your php.ini configuration directives:

  • error_reporting - should be set to E_ALL | E_STRICT for your development environment
  • display_errors - should be set to On


I had the same problem, even with all error reporting enabled.

I tried to put echo statements into my test and setUp methods to find out where it was hanging, but they never appeared. The problem turned out to be PHP's output buffering. When I added the following method to my test:

protected function debug($text){    echo "\nDEBUG: $text\n";    flush();    ob_flush();}

and used $this->debug() instead of plain echo, I was able to see my debug statements. A binary search through the code quickly led to the source of the problem (an invalid database fixture, in my case).