How to use Behat with Vagrant on Windows host?

Hello all. I'm trying to use Behat with a remote environment on Vagrant. I have my remote PHP interpreter setup and working, as well as Behat using said interpreter and all is well there. My problem though is that when I run my Behat run configuration, PHPStorm is trying to pass the Windows path to the Behat config, rather than the actual UNIX path on Vagrant. How can I fix this? For example, the output from PHPStorm looks like this:

ssh://vagrant@192.168.10.160:22/usr/bin/php /home/vagrant/.phpstorm_helpers/behat.php --format PhpStormBehatFormatter --config N:\path\to\project\behat.yml Testing started at 12:24 PM ... bash: line 0: cd: N:/path/to/project: No such file or directory


I already have a "server" configured in Settings | PHP | Servers with path mappings setup for use with xdebug, which works fine, however it seems that I'm never able to select this server in the case of Behat.

Is what I want to do supported? I don't understand why there would be an option to use a remote interpreter if not.

Thanks!

5 comments
Comment actions Permalink

Hi there,

How did you configure your Remote PHP Interpreter? I mean -- what source have you used: vagrant details, custom SSH or existing SFTP Deployment entry?

Suggestion to try:

  • If you do not use SFTP as a deployment (to upload files to Vagrant) then please set up new entry, configure it and mark it as Default for this project
  • If Remote PHP Interpreter was created using vagrant details or custom SSH details, then please create new one using that SFTP entry; choose it as PHP Interpreter for this project.
  • Try with such details
0
Comment actions Permalink

I do not use PHPStorm for deployment. I use an NFS share to sync files to the Vagrant instance.

The Remote PHP Interpreter is using SSH. Am I able to do your suggestion without having PHPStorm try to deploy files to Vagrant?

0
Comment actions Permalink
Am I able to do your suggestion without having PHPStorm try to deploy files to Vagrant?

Hard to say as I have only used SFTP for my rather limited Vagrant experience.

In theory .. just configuring SFTP and Remote Interpreter as previously suggested *should be* enough (deployment may never actually happen -- only path mappings will be used for path transformations). Although helper script may actually be transferred (not sure -- only used "proper" SFTP) in any case as it's created by IDE and not part of the actual project.

0
Comment actions Permalink

The helper scripts are transferred anyway, which is fine.

I'll give your suggestion a try tomorrow and let you know. Thanks!

0
Comment actions Permalink

After messing around a little today and looking into your suggestion, I have decided that I don't want to go that route. I don't want to setup SFTP deployment when I don't really want that and won't use it. If that is the only way to use Behat remotely then I'll just stick to running it from the command line. It's a bit unfortunate if that is the only way. Hopefully better support for that makes its way into a future version.

I appreciate your help though.

0

Please sign in to leave a comment.