So I'm trying to setup remote unit testing from a virtualized system (how, is not important). I'm using a simple samba connection so my files are accessible locally.
The issue is the fact that PHPStorm uses a very lousy way on figuring out where to store _intellij_phpunit_launcher.php.
My project consists of a few files:
Obviously, my webroot is set to /public, so other files are not accessible. This is common practice in most projects like symfony2 etc. Locally, i've mounted my /wwwroot as a samba share on /Volumes/www
. Server path mappings from /Volumes/www/myproject to /wwwroot/myproject are set and things like remote web & cli debugging work perfectly.
In the "PHPUnit on Server", i choose to use a XML file. I *must* use an alternate configuration file because it can't find phpunit.xml to begin with. Note that everything here must be set with *local* paths (ie: /volumes/www/myproject).
The deployment-server i'm using is of type "in place". However, here I can only set mappings from local paths to *web paths* (not remote paths!). This means my mapping becomes:
/Volumes/www/myproject/public => /
The issue now: the "use alternate configuration file" in the run configuration now is invalid, as i'm using /Volumes/www/myproject/phpunit.xml: it does not know anything about /Volumes/www/myproject/, as our web path mapping is to: /Volumes/www/myproject/public.
So obviously,i changed the path mapping from: /Volumes/www/myproject/ => /
At least now the run configuration does not complain, but the problem is that _intellij_phpunit_launcher.php get copied to this specific directory. Meaning it will get copied /wwwroot/myproject/_intellij_phpunit_launcher.php. Obviously, when phpstorm tries to connect to this file on the webserver it will fail, as this is NOT a web-accessible directory.
It would be REALLY nice if we could have an option to change this and have some kind of "override" where this _intellij_phpunit_launcher.php file is stored. Seems easy enough.
There is no easy way to do this kind of unit-testing (at least, i can't get it running, so i assume there are things i'm missing). But i figured out another way:
I've created an empty dummy.xml file inside the public directory: /wwwroot/myproject/public/dummy.xml
This file I can select as alternative configuration file.
However, i will override this file through the "test runner options" by issuing "-c phpunit.xml".
This does not work out of the box, but we can also change the custom working directory here as well. When using "..", it will actually change to the parent directory of "public", which is the correct directory. My original phpunit.xml will have all it's directories relative from the root of the project so everything works correctly. Using other paths will result in a refusal of PHPStorm running the unit-tests, as you must create additional path mappings.
With this kind of quickfix, at least PHPStorm/_intellij_phpunit_launcher does not complain about files not found, and unit-testing seems to be working correctly.
But obviously, a better fix like being able to set a location where phpstorm stores it's _intellij_phpunit_launcher would be a much better solution.
So, in the end, i have a few questions:
- is this the correct way to deal with remote/virtualized system phpunit testing?
- are there better ways to deal with this?
- are there possibilities to change the location of _intellij_phpunit_launcher another way?