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!
请先登录再写评论。
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:
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?
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.
The helper scripts are transferred anyway, which is fine.
I'll give your suggestion a try tomorrow and let you know. Thanks!
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.