Is it possible to debug PhpUnit tests with --process-isolation option?
For unittest
class SampleTest extends PHPUnit_Framework_TestCase
{
public function testBreakpoint()
{
$a = 18;
}
}
with breakpoint on line 5 "$a = 18;",
Xdebug v2.1.0,
PHPUnit 3.6.10,
PHP 5.3.6,
PHPStorm 3.0.3.
Running unittest with NO --process-isolation option in 'Test Runner options' in 'Run/Debug Configuration ' by Shift-F9 'Debug' stops execution on line 5, as expected.
Running the same 'Run/Debug Configuration ' WITH --process-isolation option in 'Test Runner options' by Shift-F9 'Debug' does not stop execution on line 5.
The option --process-isolation runs every testcase in new process using 'proc_open' in runJob function in https://github.com/sebastianbergmann/phpunit/blob/3.6/PHPUnit/Util/PHP.php
Is it possible to debug child process created by PhpUnit using Xdebug and PhpStorm?
Please sign in to leave a comment.
Hello Alex,
Thank you for feedback!Unfortunately it haven't not supported yet. Please vote for the following issue - http://youtrack.jetbrains.com/issue/WI-7355.
Thank you Nikolay for quick and exact answer.
The issue is upvoted. Hope to see it in V4.
I am facing the same problem, the mentioned issue seems to be fixed but debugging of isolated process still ignores break points. As before, they work fine without process isolation. Is there a way to make this work?
Since it would be new/isolated process .. the xdebug debug status may not propagate there.
See if configuring xdebug with xdebug.remote_autostart = 1 will do any better (so that xdebug attempts to debug every single request) -- it should.
:O:O:O:O:O:O:O WORKS!
For others who might be wondering, make sure to Run > Start Listen for PHP Debug Connections.
Hi! 6 years later, this doesn't work. The issue I am experiencing now is that, although I definitely "Start Listening For PHP Debug Connections", and set `xdebug.remote_autostart` to `1`, this doesn't matter because the `xdebug` extension does not appear to be enabled in the child process. Looks like it's the `-dzend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20151012/xdebug.so` (correctly configured, as PHPStorm recognizes this in the interpreter settings) is what doesn't propagate into the child process. I know this because I output `get_loaded_extensions()` in the test code, and it doesn't include `xdebug`, while if I do it while stepping through PHPUnit's code - it does.
Any ideas?
Would it be possible to show the xdebug section from your php.ini file? (just share the "php -i" output)
What is important here -- do you "zend_extension" configured in php.ini?
(for the reference purposes: https://youtrack.jetbrains.com/issue/WI-33283)