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 ..?
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.xand your code base seems not be fit for this version and requires you to downgrade toPHPUnit 3.5.15You 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.15In 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.phpis needed.The current way structuring phpunit test suites (recommended since 3.4.) is described here:
PHPUnit manual: Organizing tests