Why is PHPUnit hiding the xdebug return line?

I have PHPUnit and xdebug installed, and in my php.ini files for the CLI I have:

display_errors = On xdebug.default_enable = 1 

I checked that the xdebug reverse trace is printed when I create an error using the interactive console, but when an error occurs when starting phpunit, is there no return line?

What happens with the reverse gear? Is phpunit hiding from me? Are there any settings that I am missing?

Thanks!

+3
source share
2 answers

What happens with the reverse gear? Is phpunit hiding this from me?

Yes, PHPUnit disables xdebug, at least these traces (by calling xdebug_disable() Docs ).

Are there any settings that I am missing?

You can add a bootstrap file in which you include it again with xdebug_enable() Docs . This works, but will show you the stack trace on any exception thrown (caught or unmapped).

See also: Problem # 221 PHPUnit disables xdebug , there is another ini installation:

sebastianbergmann: the problem is configuring xdebug.show_exception_trace . If set to 1 , it will "show the stack trace whenever an exception occurs, even if that exception is actually caught." This behavior interrupts the output of PHPUnit.

Now, if I remember correctly, Derick recommended using xdebug_disable(); above ini_set('xdebug.show_exception_trace', 0); .

+7
source

This is because unit tests with phpunit are run from the console, which is a CLI application. You can run it with:

 php -dhtml_errors=1 `which phpunit` yourteststuff. 
+1
source

All Articles