PHPUnit 在 Fedora 16 中不起作用

发布于 2024-12-18 03:50:08 字数 2030 浏览 3 评论 0原文

最近我将我的机器升级到了 Fedora 16。PHPUnit 在 Fedora 15 上工作得很好。但是升级后,当我运行测试时,它给出了

PHP 警告:require_once(PHPUnit/Framework.php): 无法打开流:没有这样的文件或第 19 行“PATH TO MY TEST CLASSS”.php 中的目录 PHP 堆栈跟踪:

PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:145
PHP   5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:104
PHP   6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:168
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP   8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:79
PHP   9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:95

PHP 致命错误:require_once():无法打开所需的 'PHPUnit/Framework.php' (include_path='.:/usr/share/pear:/usr/share/php')在“PATH TO MY TEST CLASS”.php 第 19 行 PHP 堆栈跟踪:

PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:145
PHP   5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:104
PHP   6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:168
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP   8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:79
PHP   9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:95

这可能是什么问题。 ?有帮助吗..?

Recently I upgrade my machine to fedora 16. PHPUnit worked fine on fedora 15. But after upgrade , when I run tests , it gives

PHP Warning: require_once(PHPUnit/Framework.php): failed to open stream: No such file or directory in "PATH TO MY TEST CLASSS".php on line 19
PHP Stack trace:

PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:145
PHP   5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:104
PHP   6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:168
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP   8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:79
PHP   9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:95

PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Framework.php' (include_path='.:/usr/share/pear:/usr/share/php') in "PATH TO MY TEST CLASS".php on line 19
PHP Stack trace:

PHP   1. {main}() /usr/bin/phpunit:0
PHP   2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:44
PHP   3. PHPUnit_TextUI_Command->run() /usr/share/pear/PHPUnit/TextUI/Command.php:125
PHP   4. PHPUnit_Runner_BaseTestRunner->getTest() /usr/share/pear/PHPUnit/TextUI/Command.php:145
PHP   5. PHPUnit_Runner_BaseTestRunner->loadSuiteClass() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:104
PHP   6. PHPUnit_Runner_StandardTestSuiteLoader->load() /usr/share/pear/PHPUnit/Runner/BaseTestRunner.php:168
PHP   7. PHPUnit_Util_Fileloader::checkAndLoad() /usr/share/pear/PHPUnit/Runner/StandardTestSuiteLoader.php:78
PHP   8. PHPUnit_Util_Fileloader::load() /usr/share/pear/PHPUnit/Util/Fileloader.php:79
PHP   9. include_once() /usr/share/pear/PHPUnit/Util/Fileloader.php:95

What can be the issue for this. ? Any Help ..?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随遇而安 2024-12-25 03:50:08

我假设您是通过 fedora 包管理器安装 PHPUnit?这将是操作系统版本对此产生任何影响的唯一原因:)

在这两种情况下,您的问题似乎是您正在运行 PHPUnit 3.6.x 并且您的代码库似乎不适合此版本并要求您降级到 PHPUnit 3.5.15

您可以使用 pear 安装程序(而不是从软件包安装 phpunit)来执行此操作,因此请删除该软件包并按照以下相关部分进行操作:

将 phpunit 3.6 降级到 3.5.15


一般来说,不再需要该文件。 phpunit 运行程序将完成所有内容,如果您使用某些自定义运行程序,则只需要 PHPUnit/Autoload.php

当前构建 phpunit 测试套件的方式(从 3.4 开始推荐)描述如下: PHPUnit 手册:组织测试

I'd assume you are installing PHPUnit through the fedora package manager? That would be the only reason why the os version would have any impact on that :)

In both cases your problem seems to be that you are running PHPUnit 3.6.x and your code base seems not be fit for this version and requires you to downgrade to PHPUnit 3.5.15

You can do this using the pear installer (instead of installing phpunit from packages) so remove the package and follow the relevant part of:

Downgrading phpunit 3.6 to 3.5.15


In general it is not needed to require that file anymore. The phpunit runner will that up everything and in case you are using some custom runner only PHPUnit/Autoload.php is needed.

The current way structuring phpunit test suites (recommended since 3.4.) is described here: PHPUnit manual: Organizing tests

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文