我已经在本地Windows机器和远程Linux服务器上安装了PHPUnit。 我能够从Netbeans本地运行PHPUnit。 我的下一步是,使用Netbeans触发PHPUnit.bat脚本来: – SSH到远程服务器 – 从那里运行PHPUnit
手动操作,我可以使用PLink进行SSH,并从远程服务器的PHPUnit运行中取回输出。
任何想法如何configurationPHPUnit.bat脚本来做到这一点?
您需要编写自己的批处理脚本来执行相同的手动步骤。 捕获NetBeans传递的参数,ssh到服务器,以及使用相同的参数执行PHPUnit应该不会太困难。
由于这不是PHPUnit所特有的,为了得到更广泛的支持,您应该重新发布这个问题来定位脚本编写者。
如果这可以帮助:从NetBeans 7.4远程运行phpunit的Windows脚本:
phpunit.bat
@echo off :: ============================================================= :: Remote execute phpunit command to VM and downloading result :: ============================================================= :: - assuming project is replicated remotely (WinSCP ?) :: - assuming NetBeansSuite.php file somewhere in remote VM :: - using :: * PuTTY tools - http://www.chiark.greenend.org.uk/~sgtatham/putty/ :: * sed.exe - http://gnuwin32.sourceforge.net/packages/sed.htm :: remote serveur PuTTY silent connection (auto-login, key authentication with pageant) set REMOTE_SERVER=your_putty_saved_session_name :: root path of all local netbeans projects, despecialized for sed set LOCAL_WORKSPACE=C:\/Apps\/Wamp\/www :: remote path of all projects, despecialized for sed set REMOTE_WORKSPACE=\/var\/www\/projects :: remote location of NetBeansSuite.php, despecialized for sed set REMOTE_NETBEANSSUITE=\/usr\/local\/share\/php\/phpunit\/NetBeansSuite.php :: Location of junit log set REMOTE_LOG_JUNIT=nb-phpunit-log.xml :: Patch params : \ to /, clean log path, change workspace, change NetBeansSuite echo %* | sed -e "s/\\/\//g" -e "s/[^ ]*nb-phpunit-log.xml/%REMOTE_LOG_JUNIT%/g" -e "s/%LOCAL_WORKSPACE%/%REMOTE_WORKSPACE%/g" -e "s/[^ ]*NetBeansSuite.php/%REMOTE_NETBEANSSUITE%/g" > %TMP%\res.txt set /p PARAMS=<%TMP%\res.txt :: Launch phpunit and revert remote path in the output echo plink -batch %REMOTE_SERVER% "phpunit %PARAMS% | sed -e 's/%REMOTE_WORKSPACE%/%LOCAL_WORKSPACE%/g' -e 's/\//\\/g'" plink -batch %REMOTE_SERVER% "phpunit %PARAMS% | sed -e 's/%REMOTE_WORKSPACE%/%LOCAL_WORKSPACE%/g' -e 's/\//\\/g'" :: Download result set LOCAL_LOG_JUNIT=%3% pscp -q -batch %REMOTE_SERVER%:%REMOTE_LOG_JUNIT% %TMP%\res.txt :: Revert remote path to local path in log file (beware of XML ending tag which must not be translated). sed -e "s/%REMOTE_WORKSPACE%/%LOCAL_WORKSPACE%/g" -e "s/\([^<]\)\//\1\\/g" %TMP%\res.txt > %LOCAL_LOG_JUNIT%