PHPUnit on Server/xdebug problem

Has anybody managed to get "PHPUnit on Server" and xdebug to work together correctly?

1.) Debugging of remote Unit-Tests does not work
Break on first line - PhpStorm goes into the debugger with the file  "_intellij_phpunit_launcher.php" but does not halt on the breakpoints  inside the testclasss. The apache process seems to segfault.

2.) PHPUnit config.xml is ignored
When confguring a phpunit config.xml a windows path is forced (eg.  X:\trunk\tests\config.xml) but an Error "Could not read  "X:/trunk_phpunit/tests/config.xml".' in  /usr/local/share/pear/PHPUnit/Util/Configuration.php..." is triggered  (different path mappings no not change this).

3.) "_intellij_phpunit_launcher.php" in SVN
On running a debug on a UnitTest I keep getting asked if i want to add "_intellij_phpunit_launcher.php" to my svn repository.

4.) Test groups not selectable/not stored
The Testgroups Tab is only enabled when "Test: All in Directory" is selected. After changing the Include/Exclude Checkboxes OK/Applying and reopening the dialog the checkbox "include/exclude groups" is still checked, but the Include/Exclude/Group Name Options are not clickable.

5.) Test goup settings are ignored
When running a test from Example 4 the group settings are completely ignored.

Background:
1.) standard remote debuggung works
2.) simple remote running of unit tests does work (but without bootstrap or config.xml not useable)
3.) PHPUnit on Server using "In-Place" Serversetting
4.) Mappings seem to be ok (xdebug paths seem to dereference symlinked paths)
5.) php 5.4.6, xdebug 2.2.0

For some of the problems there where bugreports - old ones, fixed ones, undecided ones
eg. WI-9369, WI-4559, WI-10888, WI-10887, WI-8710, WI-7055, WI-5559

no sure how to proceed now - remote unittest debugging is essential

Manfred

2 comments
Comment actions Permalink

[SOLVED] I managed to make this work

1.) Debugging of remote Unit-Tests does not work
Break on first line - PhpStorm goes into the debugger with the file   "_intellij_phpunit_launcher.php" but does not halt on the breakpoints   inside the testclasss. The apache process seems to segfault.

FIX: Updating to PHP 5.4.7, XDebug to 2.2.1, phpunit 3.7.8 solved this issue.

2.) PHPUnit config.xml is ignored
When confguring a phpunit config.xml a windows path is forced (eg.   X:\trunk\tests\config.xml) but an Error "Could not read   "X:/trunk_phpunit/tests/config.xml".' in   /usr/local/share/pear/PHPUnit/Util/Configuration.php..." is triggered   (different path mappings no not change this).

BUG: the path mapping between local (PC) and remote (Server) paths is not applied. Workaround: use a mod_rewrite rule to intercept the request to _intellij_phpunit_launcher.php and inject a bootstrap.php file - warning: this might trigger a security problem. WI-9369

3.) "_intellij_phpunit_launcher.php" in SVN
On running a debug on a UnitTest I keep getting asked if i want to add "_intellij_phpunit_launcher.php" to my svn repository.

Workaround: This can be ignored in the dialog setting

4.) Test groups not selectable/not stored
The Testgroups Tab is only enabled when "Test: All in Directory" is selected. After changing the Include/Exclude Checkboxes OK/Applying and reopening the dialog the checkbox "include/exclude groups" is still checked, but the Include/Exclude/Group Name Options are not clickable.

BUG: no solution, no workaround WI-10888

5.) Test goup settings are ignored
When running a test from Example 4 the group settings are completely ignored.

BUG: no solution, no workaround - calling from the commandline the groups are working WI-10887


Notes for troubleshooting and reference:

1. Without correct mapping of the PC-Filepath to the Server-Filepath in settings/php/server the debugger does not stop and ask as it does in normal debug mode. (verify with break in first line setting)
2. i need to load the xdebug php extension always as zend_extension= only and never as extension=... - i even have to remove the extension=... setting from php/extensions.ini
3. unit debugging also works with xdebug.remote_connect_back=1 (some old bugreport suggests to use remote_connect_back=0 and xdebug.remote_host=...)
4. a local php and phpunit installation is NOT necessary for remote phpunit calling and debugging
5. on the path mapping settings only the topmost entry must be mapped - the rest is applied implicitely
6. The working versions are php 5.4.7, xdebug 2.2.1, phpunit 3.7.8
7. A proper how-to/documentation would have saved me some hours ...

Manfred

0
Comment actions Permalink

Hi there,

I'm glad you managed to fix the issue (made it to work, at least), especially on your own.

Few random comments from a person who is using PhpStorm for over 2 years now and follows this site for a bit:

2. i need to load the xdebug php extension always as zend_extension= only and never as extension=... - i even have to remove the extension=... setting from php/extensions.ini

That's mentioned in every xdebug installation manual/article actually .. and one of the common mistakes as well, unfortunately -- it's quite easy to miss this moment when reading such manuals.

In any case -- here is the "local" link (in case you have not seen it yet): http://confluence.jetbrains.net/display/WI/Xdebug+installation+guide

4. a local php and phpunit installation is NOT necessary for remote phpunit calling and debugging

50/50. You do not need PHP, but you may need local PHPUnit files if you are going to debug and will go inside one of such PHPUnit's own methods (accidentally or on purpose).

5. on the path mapping settings only the topmost entry must be mapped - the rest is applied implicitely

Not sure about you, but for me it was quite obvious that you can map whole folder and then all subfolders and files will be mapped accordingly internally. But yeah -- I've seen one person already who was trying to map every single file of a large framework -- not sure why he thought he cannot map folders and what can be done here to make it more obvious.

6. The working versions are php 5.4.7, xdebug 2.2.1, phpunit 3.7.8

I'm not sure about PHP and PHPUnit, but xdebug v2.2.0 is unstable/buggy and most likely upgrading it on its own to v2.2.1 should have solved that segfault issue.

7. A proper how-to/documentation would have saved me some hours ...

100% Agree. And there is some manuals available, but they are scattered across different sections:

3.) "_intellij_phpunit_launcher.php" in SVN
On running a debug on a UnitTest I keep getting asked if i want to add "_intellij_phpunit_launcher.php" to my svn repository.

Well -- because tests are executed on remote site, the wrapper/helper needs to be uploaded there as well, and VCS integration may notice such new file in the project. Adding it to ignored list is the right choice .. but I would been expecting this to be handled automatically by PhpStorm with no need for user to do this manually.

BUG: no solution, no workaround - calling from the commandline the groups are working WI-10887

When executing local PHPUnit tests, the wrapper/helper just collects some details and passes all data/configs to PHPUnit itself for the actual execution. When executing it remotely ... the wrapper does a lot more... Before v3 (not 100% sure, maybe before v4) the local execution was handled by similar wrapper as well, but since then it was rewritten, but not the remote one. Hopefully devs will fix it in v6 (@devs, please, yes -- it has some votes?)


BTW -- you could vote for those tickets as well -- if ticket gets some votes it attracts some attention from devs. The more votes the higher the priority (at least in theory, hey).

Onca again -- congrats on solving the issue.

0

Please sign in to leave a comment.