首页 > 解决方案 > xdebug 未捕获命令 php artisan test

问题描述

我正在努力解决以下行为:

如果我执行php ./vendor/bin/phpunitXdebug 将捕获我在 Visual Studio 代码中设置的任何断点。

否则,如果我执行php artisan test断点将被绕过。

Ps:当我使用这两个命令时,XDebug 捕获了工匠的第一行文件,但我的测试文件(位于测试文件夹中)仅被php ./vendor/bin/phpunit

我在用着:

PHP 7.3.9.
Xdebug v2.9.0.
Laravel/framework: 7.0.
OS: Mac OS Catalina
Web Server: Mamp PRO

我的 XDEBUG 设置:

MAMP_Xdebug_MAMPzend_extension="/Applications/MAMP/bin/php/php7.3.9/lib/php/extensions/no-debug-non-zts-20180731/xdebug.so"
xdebug.remote_enable=1
xdebug.remote_host=localhost
xdebug.remote_port=9000
xdebug.remote_autostart=1
xdebug.idekey=VSCODE
xdebug.profiler_enable=1
xdebug.profiler_output_dir="/Applications/MAMP/tmp"

提前谢谢你。

标签: phplaraveltestingxdebug

解决方案


我认为您的命令行 PHP 不是来自 MAMP 的命令行。

Mac OS 安装了自己的版本。比较您的 MAMP 服务器的确切版本和您的 CLI 版本。

尝试 MAMP PHP 的完整路径:

/Applications/MAMP/bin/php/php7.3.9/bin/php artisan test

推荐阅读