How to use PHPUnit 4.6 PHAR with IDE 9

I have been unsuccessful in trying to use PHPUnit with Komodo IDE 9. I have installed PHPUnit 4.6.7 (stable) using the recommended approach using a .phar. Running tests through the command line works properly but cannot run tests through Komodo.

It seems the harness cannot find the correct PHPUnit libraries as I get the following error:

Warning: require_once(PHPUnit/Runner/Version.php): failed to open stream: No such file or directory in C:\Program Files (x86)\ActiveState Komodo IDE 9\lib\mozilla\python\komodo\harnesses\php\Base\HarnessSelector.php on line 10

I have read this thread How to use PHPUnit with Komodo? and have not been able to find a fix in that thread.

Any recommendations?

Seems like Komodo doesn’t work with PHPUnit 4.*
Try to use PHPUnit 3.7.21 because this version works fine for @careyh:

That is disappointing. Unfortunately using a 2 year old version of a core technology isn’t really an option for me at my job.

I was able to cobble something together with edits to HarnessSelector.php and Printer.php and it seems to be working for me now.

Surely there’s a way to make this work. The older version of phpunit (3.7.24) has a host of problems itself, not the least of which is that its documentation is disappearing from the web. Newer versions are distributed ONLY as phar files.

I’m using Komodo IDE v9.0.1, doing remote debugging on a linux VM (runs as a guest on my Windows 7 pro box) with the IDE running in Windows.

I’ve updated phpunit to v4.6.7. When I attempt to step into a phpunit file, Komodo prompts me for a URI mapping – except that the URI it prompts with (“phar:/usr/bin/phpunit/”) uses “phar” as the scheme name rather than “file”. I’ve used Phar::extractTo() to extract the archive into a tree that corresponds to the remote URI. I’ve installed URI mappings using this approach, and they don’t work – at all. Komodo ignores them, prompts for a mapping even though one is there, and opens read-only versions. That means I can’t set breakpoints anywhere inside the phar.

My shop uses perl and php. I posted a topic here yesterday because the Komodo IDE ignores most breakpoints in perl while debugging remotely. Today, it seems that Komodo is also seriously impaired in its ability to handle current versions of phpunit.

I’m looking for a work-around that lets me work on the code I’m paid to develop and support. Reverting to an obsolete version of phpunit is not an option for me.

UPDATE:
I’ve found that I can map each remote file in the phar archive using its own URI mapping. This allows the IDE to show the local copy. Sadly, setting breakpoints like this has no discernible effect. The breakpoint is listed in the “Breakpoints” pane, displayed in the IDE, and so on. The breakpoint is, however, ignored on the remote side.

I’ve logged a bug for this here: https://github.com/Komodo/KomodoEdit/issues/302

Sorry for the inconvenience.

Hey @nardberry any chance you could share your edits to the HarnessSelector? I’d love to get PHPUnit 4.x running in IDE 9, and all the edits I’ve attempted seemed to make it worse heh.

@girvo Unfortunately I didn’t keep track of the changes. If you share the original files with me (HarnessSelector.php & Printer.php) I will find my edits and share them with you.

@girvo As it turns out I had to re-do my changes after updating Komodo to the latest version, and uploaded my changed files here: https://github.com/darnellefunk/komodo-phpunit-harness

2 Likes