我想使用Eclipse插件“makegood”在Eclipse中使用php-unit-tests。当我在控制台上运行phpunit时,一切正常。
我按照以下说明在Eclipse中设置了makegood-plugin:http://www.stuermer-benjamin.de/v12_1/eclipse-4-2-with-php-android-and-unit-testing/
makegood的状态是“等待测试运行...”,但是当我尝试运行单元测试时,我在控制台中打印出此错误:
Fatal error: Class
> 'Stagehand\TestRunner\CLI\TestRunnerApplication\Command\CommandRepository'
> not found in C:\Users\myNameWith18Charac
> \.eclipse\org.eclipse.platform_4.3.0_1709980481_win32_win32_x86_64\plugins\com.piece_framework.makegood.stagehandtestrunner_2.5.0.v201311031709\resources\php\php\Stagehand\TestRunner\CLI\TestRunnerApplication\Application.php
> on line 64
>
> Call Stack:
> 0.0000 148336 1. {main}() C:\Users\myNameWith18Charac\.eclipse\org.eclipse.platform_4.3.0_1709980481_win32_win32_x86_64\plugins\com.piece_framework.makegood.stagehandtestrunner_2.5.0.v201311031709\resources\php\bin\testrunner.php:0
> 0.0100 460744 2. Stagehand\TestRunner\CLI\TestRunnerApplication\Application->__construct()
> C:\Users\myNameWith18Charac\.eclipse\org.eclipse.platform_4.3.0_1709980481_win32_win32_x86_64\plugins\com.piece_framework.makegood.stagehandtestrunner_2.5.0.v201311031709\resources\php\bin\testrunner.php:58
班级Stagehand\TestRunner\CLI\TestRunnerApplication\Command\CommandRepository
已存在!
路径可能太长了吗?但我不知道,如何改变它。我正在使用win7 x64。
答案 0 :(得分:1)
我在Ubuntu中看到了同样的事情,运行Eclipse Kepler和PDT 3.3。
在MakeGood中启用调试,我可以看到实际运行的命令是php
,其中包含我正在查看的文件的单个参数(E.G测试)。
它根本不像宣传的那样工作,因为它只是试图自己执行文件。
降级到Eclipse 3.8(Juno),PDT 3.0.0为我工作。
<强> *修改:
您可以将自定义bash脚本定义为php可执行文件作为变通方法,并将路径硬编码为testrunner.php
#!/bin/bash
# MakeGood for PHP stopped working after Eclipse Indigo (3.8) due to inability to run testrunner.php
# This is a hack PHP binary, to be configured as PHP executable for MakeGood to start working in Juno, Kepler and Luna.
# Remove the -n operator to read all config files
options=`echo $@ | sed 's%-n %%' | sed 's%-c .+? %%'`
# Hardcode path to testrunner.php
options=`echo $options | sed 's@open_tag=on [^ ]*@open_tag=on /opt/testrunner.php
/usr/bin/php $options