【发布时间】:2011-01-04 16:06:50
【问题描述】:
我在 Eclipse 的一个 PHP 项目中有以下 class 和 unit test:
我知道我的单元测试有效,因为我可以在命令行运行它:
现在我想从 Eclipse 运行这个测试。我在 Eclipse 中这样设置 PHP 单元:
但是,当我运行 PHPUnit 测试时:
它告诉我它不能包含类文件:
/usr/bin/php -c /var/folders/UA/UAv38snBHd0QMgEPMCmM9U+++TM/-Tmp-/zend_debug/session4910937990995915704.tmp -d asp_tags=off /Applications/eclipse/plugins/org.phpsrc.eclipse.pti.tools.phpunit_0.5.0.R20101103000000/php/tools/phpunit.php --log-junit /var/folders/UA/UAv38snBHd0QMgEPMCmM9U+++TM/-Tmp-/pti_phpunit/phpunit.xml /Volumes/data/domains/et/extjslayout/phpunittest/tests
PHP Warning: include_once(../Product.php): failed to open stream: No such file or directory in /Volumes/data/domains/et/extjslayout/phpunittest/tests/ProductTest.php on line 3
PHP Warning: include_once(): Failed opening '../Product.php' for inclusion (include_path='/usr/local/PEAR') in /Volumes/data/domains/et/extjslayout/phpunittest/tests/ProductTest.php on line 3
PHP Fatal error: Class 'Product' not found in /Volumes/data/domains/et/extjslayout/phpunittest/tests/ProductTest.php on line 9
为什么 PHPUnit 从命令行运行时能找到类,而从 Eclipse 运行时却不能?
【问题讨论】: