Custom PHP Script for running PHPUnit on Server

Hi there,

I would like to execute my own php script on a remote server for running unit tests triggered from PHPStorm. I wrote a script that uses the TestListener from the _intellij_phpunit_launcher.php script that is normally used for running PHPUnit scripts on a remote server and if I call my script on a webserver, I get the PHPStorm output as expected. The problem is, that I cannot set my custom script within the "PHPUnit on server" configuration in PHPStorm's run configuration. Is there any way to change the default behaviour and use my script?

Basically, what I would like to do is ignore the "deployment process" described here: http://devnet.jetbrains.com/message/5303499#5303499 and rather call my own script on the server to generate the PHPUnit output.

The reason I need this, is that I have to set up a TYPO3 environment for my unit tests.

Thanks for any advice!

Michael

3 comments

Hi Michael,

You can not use another script instead of default one ... unless you edit the original one (I mean -- replace original script in PHP plugin). It is possible, since plugin consists of .jar file(s), which is just a .zip file inside. This, of course, means that you will have to replace such script for each new PhpStorm build you will be using (unless original script will be fixed, which will allow you use your own bootstrap.php where you can set up your custom environment).

0

Hi Andriy,

thanks for your quick response. I found the script in the php.jar file but replacing it will not fix my problems. I try to describe what I am want to do, so perhaps you can offer me an alternative. Here is a description of my working setup:

- I have a virtual machine running inside a virtual box. I use the virtual machine as my web server, database etc.
- Files are mounted via SMB to a Mac OS X system which I use for development (PHPStorm is running here)
- Within the project running on the virtual machine, I have unit tests which I need to run there since they need a TYPO3 environment to be set up before running

So replacing the script you are uploading to the server for running the unit tests only solves part of my problems. First, I have no FTP / SFTP access to the server, so this won't work. Second (and more important), I do not want to tell PHPStorm, which tests to run, since my environment itself knows which tests are to be run.

Let me explain the workflow I would suggest, which I think only needs very little changes to be made inside PHPStorm:

1. Offer the option to use a URL for unit testing inside the "PHPUnit on server" dialog
2. Offer the possibility to pass some "dynamic" options to the script (e.g. current folder, current testcase...)
3. When running the tests, simply call the URL (with the given options)
4. The result from the script run by the URL needs to have the format that you already use for your method when uploading the script (the registered test listener is doing a good job here)
5. Parse the result and use it for the gui output inside PHPStorm

I would be very happy, if you could add this feature or tell me how to enable it. I am even willing to write a plugin for PHPStorm to enable this feature.

Hope to hear from you - again thanks for your response!

Michael

0
First, I have no FTP / SFTP access to the server, so this won't work.

As I understand you are uploading files there via SMB -- you can use "Local or Mounted Folder" deployment option for that.

Second (and more important), I do not want to tell PHPStorm, which tests to run, since my environment itself knows which tests are to be run.

The script is yours -- you can put inside whatever logic you want, as long as it will provide integration.

I would be very happy, if you could add this feature or tell me how to enable it.

Those are the ways currently supported -- you cannot enable something that is simply not there.

But in any case -- feel free to submit new Feature Request(s) to the Issue Tracker. Just keep in mind, that since such request(s) would be rather unique / rare case, it may not get implemented for a long time (if at all) -- that's up to devs to decide on what to work next and what has higher priority.

I am even willing to write a plugin for PHPStorm to enable this feature.

You are welcome -- this willdefinitely benefit everyone. I'm just not sure if it is possible to add this sort of functionality (which will be implemented as separate plugin) to already existing one (will it play nice: the integration between your plugin and PHPUnit support one?).

Plugin development links:

0

Please sign in to leave a comment.