foogile / nb-remote-phpunit
使用NetBeans通过ssh执行PHPUnit测试
v0.0.2
2015-04-19 19:32 UTC
Requires
- php: >=5.3
- phpunit/phpunit: ~4.6
This package is not auto-updated.
Last update: 2024-09-20 21:42:41 UTC
README
这是一个自定义PHPUnit脚本,它使NetBeans能够在远程主机上运行测试。主要用于使Vagrant环境更易于使用,但它可以轻松扩展以与其他远程主机通信。
安装
应该使用composer安装此包
compose require foogile/nb-remote-phpunit
后续部分将描述更具体的安装过程。
Vagrant
可以使用以下命令安装默认的Vagrant测试脚本
vagrant ssh; cd /vagrant compose require foogile/nb-remote-phpunit
其他
参见“自定义测试运行器”。
用法
按照以下步骤在NetBeans 8中激活远程执行
- 右键单击您的项目并点击“属性”
- 导航到“测试” > “PHPUnit”
- 选中“使用自定义PHPUnit脚本”,并将“PHPUnit脚本”指向
VAGRANT_PATH/vendor/foogile/nb-remote-phpunit/netbeans/phpunit-vagrant.php
,其中VAGRANT_PATH
是您的vagrant文件夹的绝对路径。 - 像往常一样运行测试
自定义测试运行器
您可以通过实现自定义远程主机并提供自定义NetBeans PHPUnit脚本来在自定义远程主机上运行测试。
例如
class SSHRemoteHost implements RemoteHostInterface { public public put($localPath, $remotePath) { exec("scp $src myhost.com:$dst"); } public function get($remotePath, $localpath) { exec("scp myhost.com:$remotePath $localPath"); } public function delete($remotePath) { exec("ssh myhost.com 'rm $remotePath'"); } public function exec($command) { exec("ssh myhost.com '$command'"); }
请参见netbeans/phpunit-vagrant.php
以获取自定义NetBeans PHPUnit脚本的一个示例。
欢迎提交拉取请求 :)
致谢
基于博客文章在NetBeans上从虚拟机运行PHPUnit测试。