views:

579

answers:

2

I've been working on writing unit tests for my PHP code. PHPUnit is what I'm using for this.

I have some classes that work great until...

I throw XDebug into the mix.

At that point, PHPUnit doesn't crash or anything, but setExpectedException never triggers.

In fact, the code never goes beyond that point.

Anyone run across this and know what the solution is?

G-Man

Edit: This is with the PHP5.2.6, Latest versions of XUnit and XDebug. This is on linux fedora 7

A: 

I've had some problems before with one combination of Xdebug & PHPUnit (as did others, from a report I say on devzone.zend.com at the time), but that was a while ago. PHPUnit does explicitly support Xdebug though - and I'm using it to produce code coverage reports for my own systems.

I'd suggest the fairly standard debugging techniques, updating any versions you can (maybe even PHP?) commenting out the @setExpectedException, or throwing it explicitly - and of course, making sure that you have full warnings and errors being shown with error_reporting(E_ALL|E_STRICT); set on.

Don't forget to stop and restart the Apache server to make sure that the Xdebug module is loaded as well.

Alister Bulman
+1  A: 

This should definitely work... I use it all the time.

Derick Rethans