简体   繁体   English

如何使用Xdebug和eclipse / Zend Studio在库中调试PHPUnit测试?

[英]How to debug PHPUnit tests in a library with Xdebug and eclipse / Zend Studio?

For development and debugging I use the combination Zend Studio 12 + Xdebug. 对于开发和调试,我结合使用Zend Studio 12 + Xdebug。 The projects are stored on a Windows 7 local machine, shared with as shared folders with a Linux Virtualbox VM, and executed there. 项目存储在Windows 7本地计算机上,与Linux Virtualbox VM作为shared folders ,并在那里执行。 It's my environmnet looks like. 这是我的环境。

The debugging works and I can also debug (vendor) libraries within a "common" project. 调试工作正常,我也可以调试“公共”项目中的(供应商)库。 But if the IDE project is a library or a container with multiple libraires, it doesn't have 1. a URL (like my-project.loc ) and 2. an index file. 但是,如果IDE项目是具有多个库的库或容器,则它没有1. URL(如my-project.loc )和2.索引文件。 I've faked the URL and the index.php : 我伪造了URL和index.php

在此处输入图片说明

but it's not working. 但它不起作用。

How to get Xdebug working with Zend Studio for PHPUnit code in the context of a library / container IDE project? 如何在库/容器IDE项目的上下文中使Xdebug与Zend Studio for PHPUnit代码一起使用?

The mappings for PHPUnit of every library needed to be set up, then it worked. 需要设置每个库的PHPUnit映射,然后它才能工作。

Window -> Preferences -> PHP -> Servers -> [entry] my-server-name -> [button] Edit -> [tab] Path Maping : 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

All these mapping entries has been created by the IDE, after I called 在我调用之后,所有这些映射项均已由IDE创建

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

in the /index.php . /index.php

Don't know, why the library foo has got the mapping for the code coverage (and the other one not) and why the library bar has got the mapping for PHPUnit source (and the other one not). 不知道,为什么库foo获得了代码覆盖率的映射(而另一个没有),以及为什么库bar获得了PHPUnit源的映射(而另一个没有)。 ( It would be nice, if someone could explain that. ) But anyway -- it works. 如果有人可以解释的话,那就太好了。 )但是无论如何,它还是可行的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM