phpunit "how to get better debug information"

Hi everyone,

I just wasted 30 minutes to find a small bug in my test class (class ProjectTest extends CDbTestCase).

Running phpunit unit/ProjectTest.php from the shell all I got were "…" Two measly little dots.

So I went to the php-log file and got the following line:

"PHP Fatal error: Call to a member function save() on a non-object in /Applications/MAMP/htdocs/trackstar/protected/tests/unit/ProjectTest.php on line 0"

This wasn’t helpful either. There was nothing wrong with line 0!

So I went old-school and

  1. run another testfile, which worked (good environment works)

  2. comment the whole file out (again, phpunit is not very talkative here, just no output at all)

  3. comment all methods out (nothing again)

  4. just allow the first method to run (worked)

  5. and so forth

OK, finanlly I found the mistake, which was a wrong spelling of a before declared object.


Is there any better, faster, more modern way to get usefull debugging information on phpunit tests?



I had this alot as well, you can var_dump and exit in the php file if you execute it using the terminal, always helps me find the source of the problem faster