Explanation for how PHPUnit on server works?

I've been trying to get the PHPUnit On Server to work. This would be a killer unique feature for PHPStorm, but I've been unable to get any headway with it. I'd like to know what steps it is taking behind the scenes so maybe I can get it working with my project.Specifically I'd like to know what is being transferred, executed, where PHPStorm is looking for the output, and what PHPStorm is expecting for the output.

For what it's worth, most projects I work with have all the code files outside of the webroot and expose only a bootstrap in the documentroot. I think this may be part of the issue, but if necessary I can symlink a directory to the webroot in my development environment. Ideally I'd like to see it execute the tests via a ssh call.

My current workflow has been having a ssh terminal up and running the tests through there. I had been using Komodo before and was able to get unit test debugging working with an environment variable setting, but I've yet to get that trick to work for PHPStorm.

Thanks for any info you have!

2 comments
Comment actions Permalink

Hello Seth,

When you run your tests PhpStorm does the following:
1. upload test files and test launch script (_intellij_phpunit_launcher.php) to the server (by FTP/SFTP/network shar, depending on your deployment configuration).
2. compute the URL that corresponds to uploaded launch script depending on your deployment mappings.
3. fetch this URL by HTTP, triggering tests execution
4. launch script basically prints tests results in internal format, so PhpStorm interprets them and presents to you in a nice toolwindow
5. when tests are done, delete all the tests files and launch script from the server.

Hope this helps!

Regards,
Kirill

0
Comment actions Permalink

When you say that it uploads test files, does that mean the individual test files?
If I have a tests directory with many hierarchical test in them, and do something like a phpunit --group TICKET-123, does it grab all the tests, or just those with the proper group tag?
Does it upload them w/ directory structure? or just the flat test files?
Is there someway I can see what the code that is generated to run the test does? I haven't been able to grab the file before it gets removed.

If you're familiar with the ZendFramework test structure, I'm using something very close to that. How would you set up the ZF project to use PHPUnit on server?

Thanks for the input!

edit: After messing with it a little more, it looks like even if I specify a custom working directory, it still wants a webroot path for my Tests directory, so I'm guessing it just deploys the tests to their normal deployment area. Maybe understanding what _intellij_phpunit_launcher.php does will help me figure out what to do about that..

0

Please sign in to leave a comment.