【问题标题】:The command php artisan test isn't caught by xdebugxdebug 未捕获命令 php artisan test
【发布时间】:2020-05-17 20:45:37
【问题描述】:

我正在与以下行为作斗争:

如果我执行php ./vendor/bin/phpunit Xdebug 将捕获我在 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"

谢谢你。

【问题讨论】:

  • 你的 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"

标签: php laravel testing xdebug


【解决方案1】:

我认为你的命令行 PHP 不是 MAMP 的。

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

尝试 MAMP PHP 的完整路径:

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

【讨论】:

  • 感谢您的回答。但它还不起作用:/
  • @RomuloSousa 但完整路径有效(xdebug 除外)?路径是猜测
  • 是的,完整路径评估但没有 xdebug
  • 请确定:您的断点可以到达吗?你试过在 ./artisan 的第一行设置断点吗?
  • 然后从 artisan 文件调试到您的测试文件。我很确定你错过了一些东西并且它没有被执行。
猜你喜欢
  • 2020-03-17
  • 2016-02-07
  • 2016-04-05
  • 2015-12-07
  • 2018-06-07
  • 2019-10-26
  • 2015-04-17
  • 1970-01-01
相关资源
最近更新 更多