Search code examples
intellij-ideaphpstorm

PHPStorm 8 remote PHPUnit mapping not working


I have a vagrant VM out of my project (my projects are set-up vagrant-vm/sites/myproject)

My tests are in myproject/application/tests and I have set-up the following in phpstorm:

  1. I have a remote PHP interpreter (5.5.15-1~dotdeb.1) on my VM, set as default for my project.
  2. I have By Remote Interpreter PHPUnit configuration set up as Path to phpunit.phar and the path of it inside my VM /home/vagrant/phpunit.phar
  3. I have an SFTP deployment configuration set as default for the project, with mapping set up.

But when I run my PHPUnit run config (PHPUnit not PHPUnit on Server), I get the following log:

vagrant://C:/Users/Hugo/Documents/Projects/vagrant-swappy/usr/bin/php /home/vagrant/.phpstorm_helpers/phpunit.php --no-configuration C:\Users\Hugo\Documents\Projects\vagrant-swappy\sites\swappy\application\tests
Testing started at 11:19 ...
PHPUnit 4.1.4 by Sebastian Bergmann.

bash: line 0: cd: C:/Users/Hugo/Documents/Projects/vagrant-swappy/sites/swappy/application/tests: No such file or directory
Cannot open file "C:UsersHugoDocumentsProjectsvagrant-swappysitesswappyapplicationtests.php".


Process finished with exit code 1

EDIT: Some screenshots:


Solution

  • This feature is actually working, but PHPStorm isn't mapping your paths. For your remote setup on the "Interpreters" try selecting "Deployment configuration" and selecting your SFTP deployment configuration. Also make sure your SFTP mappings will let PHPStorm map all your file paths, and not just your web-accessible paths. The "Web path on server ..." setting under your deployment is sometimes meaningless.

    It seems that there is currently no support for vagrant-specific path mapping, although I suppose that will come. However, it ends up being a bit of a red herring.