我最近配置了 VS 代码来使用 xdebug 调试 PHP。它与我的应用程序代码一起可靠地工作,但是当我使用 PHPunit 运行单元测试时,我的断点被忽略。
我的服务器在一个流浪箱内运行。
我的php.ini文件包含以下几行:
[xdebug]
zend_extension="/usr/lib/xdebug/xdebug-2.2.7/modules/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.remote_autostart=1
我使用PHP Debug VS Code 扩展。
这是我的launch.json配置:
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
"pathMappings": {
"/var/www/mysite.local/": "${workspaceFolder}"
},
"port": 9000,
"log": true
}
我的单元测试运行良好,例如,从内/var/www/mysite.local,我可以运行:
phpunit --filter myTestMethod path/to/my/test/file/myTest.php
但是当测试将运行时,我在测试本身中的断点始终被忽略,我无法弄清楚原因。
有没有人有类似的问题?在正常应用程序请求和单元测试的上下文中调试的工作方式有区别吗?
青春有我
蝴蝶刀刀