【问题标题】:Drupal 8: Debugging tests with XDebug and PHPStorm - cennot step throughDrupal 8:使用 XDebug 和 PHPStorm 调试测试 - cennot step through
【发布时间】:2016-11-18 11:22:42
【问题描述】:

我正在尝试使用 XDebug 调试我的 Drupal 8 测试,但如果我在打开 XDebug 的情况下运行它们,我将无法进入测试。我执行以下命令:

供应商/bin/phpunit -c 核心 模块/permissions_by_term/tests/src/Kernel/SelectTermTest.php

PHPUnit 在这里报告我:

“找不到源位置。服务器名称'localhost'不存在。”

我在 PHP.ini 文件中的设置如下:

xdebug.remote_enable=true xdebug.profiler_enable=0 xdebug.idekey=PHPSTORM xdebug.max_nesting_level=256 xdebug.remote_autostart=true

有人可以在这里分享一些经验吗?

【问题讨论】:

    标签: php drupal phpunit xdebug drupal-8


    【解决方案1】:

    我让它运行。我不得不做更多的设置。

    首先,在运行配置下创建一个新的 PHP 远程调试(ZeroConfiguration 对我不起作用)。使用您想要的名称定义一个服务器(此处为“TestServer”)并输入 PHPSTORM 作为 Ide Key。

    另请参阅 Jetbrains 文档:https://confluence.jetbrains.com/display/PhpStorm/Debugging+PHP+Web+Applications+with+Run+Debug+Configurations

    在 RUN 菜单下启用“Break at first line in PHP scripts”选项。

    您可能需要覆盖文件映射。 (在我的情况下,PHPStorm 无法自动检测文件映射)(参见:https://www.jetbrains.com/help/phpstorm/10.0/override-server-path-mappings-dialog.html)。它在创建服务器的同一个对话框中。

    单击相应的图标启动远程调试会话。

    那么你应该可以使用这个命令来运行 PHPUnit:

    PHP_IDE_CONFIG="serverName=TestServer"  XDEBUG_CONFIG="idekey=PHPSTORM" vendor/phpunit/phpunit/phpunit -c YOUPHPUNITXMLCONFIG
    

    根据您的设置设置PHP_IDE_CONFIG。

    在要停止的位置设置断点。

    希望能帮到你。

    尼哥

    【讨论】:

      猜你喜欢
      • 2015-06-24
      • 2014-08-21
      • 2014-06-01
      • 1970-01-01
      • 1970-01-01
      • 2014-01-16
      • 1970-01-01
      • 1970-01-01
      • 2011-11-06
      相关资源
      最近更新 更多