-
-
Notifications
You must be signed in to change notification settings - Fork 178
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
Non functional when running phpunit on the CLI #154
Comments
I'm working on a project which uses laravel and I found two ways to run phpunit tests:
Running with |
I use this launch config which is working fine for me: {
"name": "PHPUnit",
"type": "php",
"request": "launch",
"program": "${workspaceRoot}/vendor/phpunit/phpunit/phpunit",
"cwd": "${workspaceRoot}",
"args": [
// "--filter", "whatever"
]
} |
thanks @felixfbecker for the great plugin! 🎉 I just tried your config and got the same error when I was running phpunit without any of those flags I mentioned:
I have no idea why I'm getting this btw ^^ However, adding |
Hello @felixfbecker . How do I debug a test method in phpunit? I added this script yours on launch.json. Because when I run the PHPUnit script it appears in the debug console: No tests executed! |
This is impossible to say without knowing your project |
For example if I run In the script in launch.json, I commented out the arguments, but it is not working, and I tried to put in |
did you put it in as "args": [
"--filter", "Unit\\Classes\\Graphics\\HeatmapTest::heatmap_com_animacao"
] (correct) "args": [
"--filter Unit\\Classes\\Graphics\\HeatmapTest::heatmap_com_animacao"
] (wrong) |
Now I put the correct argument, but when I run the PHPUnit script it appears in the debug console: No tests executed !. |
I've tried everything I can think of. Debugging works fine from the browser but completely ignores breakpoints on unit tests initiated directly from within VSCode. Any additional information I can provide and any idea why it's working from the browser but not working on unit tests? Thanks a lot, Windows 7 {
} |
This is the only solution that work for me (use another port to run and listen phpunit) |
Same as @serchuz, add a second configuration listening on 8000 and then: I use Lando as my development environment, which makes this solution a bit easier to implement, and I added it to their docs: |
PHP version: 7.1.0
XDebug version: 2.5.0
Adapter version: 1.10.0
Your launch.json:
XDebug php.ini config:
XDebug logfile (from setting
xdebug.remote_log
in php.ini):https://gist.github.com/johnbillion/5ade700e7a0db209d63ee95e6d60827a
Adapter logfile (from setting
"log": true
in launch.json):https://gist.github.com/johnbillion/2476befecc0b5734ae830ec8fb4584c7
Code snippet to reproduce:
N/A
The PHP Debug Adapter for Visual Studio Code works well for me over HTTP (eg. via a web page in the browser) and via the CLI with
php -f <file>
. However, when runningphpunit
on the CLI, the adaptor exhibits strange behaviour and doesn't function as expected.As soon as the command starts, two entries appear in the Call Stack panel:
These entries aren't expandable/collapsable like a normal stack trace, and the adaptor is otherwise non-functional (the only thing that works is the Stop button). The Pause button remains in place of the Continue button, breakpoints don't trigger, and the command hangs indefinitely until you exit with
ctrl+c
on the CLI or abort the execution with the Stop button in VS Code.Whilst trying to narrow down the problem, I ran the Xdebug client for Atom while running
phpunit
and it worked as expected. I was able to step through code etc as normal with no problems.Any ideas where the problem might lie? Any other debugging info I can provide?
The text was updated successfully, but these errors were encountered: