我有一个Vagrant盒子,里面有几个容器,一个容器用于PHP引擎。
通常,我在Vagrant框中运行测试,如下所示:
allprojects {
repositories {
mavenLocal()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Firebase : Google Play services from 11.2.0 +
url 'https://maven.google.com'
}
jcenter()
configurations.all {
resolutionStrategy {
// fix dependency problem on react-native-maps 0.20.1
//force "com.android.support:support-v4:27.1.0"
}
}
}
buildscript {
repositories {
mavenLocal()
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Firebase : Google Play services from 11.2.0 +
url 'https://maven.google.com'
}
jcenter()
configurations.all {
resolutionStrategy {
// fix dependency problem on react-native-maps 0.20.1
//force "com.android.support:support-v4:27.1.0"
}
}
}
}
}
但是,我想用PhpStorm运行它。有可能的?如果是,请帮忙,因为我不知道如何正确配置PhpStorm以根据需要运行PHPUnit。
答案 0 :(得分:2)
这有点复杂,因为还有一个额外的虚拟化层(主机=> Vagrant VM => Docker),但是有可能。
我们同意这些:
/home/PhpstormProjects/theProject
是您的源在主机上的路径。/var/www/html/theProject
是您的源映射到的Vagrant VM路径。/opt/theProject
是Vagrant路径通过卷映射绑定到的容器路径。首先,您需要配置Docker守护程序以侦听TCP端口: https://success.docker.com/article/how-do-i-enable-the-remote-api-for-dockerd
然后,您需要在PhpStorm Settings | Build, Execution, Deployment | Docker
上添加这些Docker服务器。
然后,在PhpStorm Settings | Languages & Frameworks | PHP
上使用所需的映像添加Docker远程解释器。
您以后需要设置以下映射:
/opt/theProject
/var/www/html/theProject
/home/PhpstormProjects/theProject
/opt/theProject
然后,在Settings | Languages & Frameworks | PHP | Test Frameworks
上为此Docker解释器配置PHPUnit,它应该能够解析路径。
基本上就是这样,您应该很好。不幸的是,无法将自定义参数传递给Docker:https://youtrack.jetbrains.com/issue/IDEA-181088
如果有任何问题,请提交支持请求:https://intellij-support.jetbrains.com/hc/en-us