badoo/soft-mocks

xdebug + phpunit + phpstorm support

altexdim opened this issue · 9 comments

When trying to debug phpunit tests in phpstorm with xdebug i got errors because file paths are different from the project files

Remote file path '/local/tmp/mocks/7.1.5-dev3.0.6ae862a422518d784a95d38efc7abb0bb/UTests/_packages/Messenger/Feature/PaidMessagesTest.php_c2abd8d2a8d2a1b461cc5b18f04b4974.php' is not mapped to any file path in project.

@altexdim, would you like to volunteer for this?

You can see pull request #35 for experimental support for xdebug and other

@altexdim, @YuriyNasretdinov
Commit in v2 branch also has support xdebug 444ee93e068cd37271080a27877ee7028897319a.
It works with https://github.com/mougrim/php-xdebug-proxy/tree/soft-mocks.
Php-xdebug-proxy release will be later.

@mougrim It turns out that xdebug can be supported without any proxies and changes in my pull request allow to do so :).

@YuriyNasretdinov What do you mean "without any proxies"? I didn't see your PR, can you please explain the main idea in more details?

The main idea is to define a custom wrapper for "file://" stream and basically after this backtraces start to look normal and xdebug starts to work out of the box as if no file rewriting was happening behind the scenes.

Great finding! Thanks, Yuriy! Sounds very promissing.

Should work with 2.0.0 version.