【问题标题】:How to debug PHPUnit tests in a library with Xdebug and eclipse / Zend Studio?如何使用 Xdebug 和 eclipse / Zend Studio 在库中调试 PHPUnit 测试?
【发布时间】:2015-08-23 17:42:09
【问题描述】:

对于开发和调试,我使用 Zend Studio 12 + Xdebug 的组合。这些项目存储在 Windows 7 本地计算机上,与 Linux Virtualbox VM 共享为 shared folders,并在那里执行。这是我的环境。

调试工作正常,我还可以在“通用”项目中调试(供应商)库。但如果 IDE 项目是一个库或具有多个库的容器,则它没有 1. URL(如my-project.loc)和 2. 索引文件。我伪造了 URL 和 index.php:

但它不起作用。

如何在库/容器 IDE 项目的上下文中让 Xdebug 与 Zend Studio for PHPUnit 代码一起工作?

【问题讨论】:

    标签: php phpunit libraries xdebug zend-studio


    【解决方案1】:

    需要设置每个库的 PHPUnit 映射,然后它才能工作。

    Window -> Preferences -> PHP -> Servers -> [entry] my-server-name -> [button] Edit -> [tab] Path Maping:

    /var/www/my-project                                     /my-project
    /usr/local/lib/phpunit-4.8.phar/phar/phpunit/Framework  /my-project/path/to/library-foo/vendor/phpunit/php-code-coverage/tests
    /usr/local/lib/phpunit-4.8.phar/phar/phpunit            /my-project/path/to/library-bar/vendor/phpunit/phpunit/src
    

    所有这些映射条目都是由IDE创建的,在我调用之后

    require_once './path/to/foo/test/Bootstrap.php';
    

    /index.php

    不知道,为什么库 foo 有代码覆盖的映射(而另一个没有)以及为什么库 bar 有 PHPUnit 源的映射(而另一个没有) . (如果有人能解释一下就好了。)但不管怎样——它有效。

    【讨论】:

      猜你喜欢
      • 2017-07-27
      • 1970-01-01
      • 1970-01-01
      • 2010-12-25
      • 2014-02-10
      • 2013-06-11
      • 2010-09-12
      • 1970-01-01
      • 2010-09-16
      相关资源
      最近更新 更多