-
Notifications
You must be signed in to change notification settings - Fork 194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Xdebug shows different lines of source code when debugging #382
Comments
What do you mean by shadow copy? If you use Monkey Patching, the line numbers are different from the actual line numbers.
I don't know. The best solution is not to use Monkey Patching. But if your code is not clean, it must be Monkey Patch hooks |
Thanks for your answer, it must be the monkey patching - I do use this. the code was written way before I did any unit testing and I have been bolted on unit testing on afterwards. |
The feature of PHP-Parser may resolve this issue, but it is experimental and not yet complete. Formatting-preserving pretty printing |
I think this issue should be left open. There is another thing that doesn't work anymore - codecoverage (for the same reason - wrong lines are reported by xdebug) @kenjis how does PHP-Parser apply here? |
@ipeevski This is the problem in PHP-Parser. Xdebug has nothing to do with.
|
For my use-case, debugging is only needed while I am doing test-driven development and not when I run all unit tests. |
@kenjis That may be so (and explains why it happened after the upgrade, since as part of that we would have upgraded PHP-Parser to 4.13) and it helps with tracking things down when debugging manually, but still doesn't help with code coverage reports. For the record, I can confirm that disabling monkey patching fixes the code coverage reports.
|
@ipeevski It seems there is no easy way to solve it.
Excluding tests that use Monkey Patching from coverage (and turn Monkey Patching off) seems to be easy. |
Excluding tests that use Monkey Patching seems like the best we could do until we rewrite tests I think |
Hi using:
the Intellij ultimate IDE.
PHPUnit 8.4.3 by Sebastian Bergmann and contributors.
i have version 3.0.1 of your framework installed in /vendor/kenjis/ci-phpunit-test
I find that when i run the unit tests from the command line the xdebug debugger opens the correct file, but the line numbers are out.
the line number being executed is in the 'shadow copy' which i have set application/tests/_
but this copy is not selected by the debugger when the tests are run.
i am not sure how the mapping between the 'shadow copy' and the code is maintained in your framework, but it seems off.
it is very difficult to debug unit tests now, previously this used to work fine.
are there any setup tricks/tips i can have to help here?
thanks.
The text was updated successfully, but these errors were encountered: