PHPunit正在运行,但我收到此代码覆盖率错误,并且没有获得代码覆盖率报告.
有谁知道如何解决这一问题?
谢谢,
德棉.
demian@dimbo-TP:/var/www/z2d2/tests$PHPunit PHPUnit 3.5.15 by Sebastian Bergmann. ... Time: 1 second,Memory: 13.00Mb OK (3 tests,4 assertions) Generating code coverage report,this may take a moment.PHP Fatal error: Class 'PHP_Token_Stream' not found in /usr/share/PHP/PHP/Token/Stream/CachingFactory.PHP on line 68 PHP Stack trace: PHP 1. {main}() /usr/bin/PHPunit:0 PHP 2. PHPUnit_TextUI_Command::main() /usr/bin/PHPunit:49 PHP 3. PHPUnit_TextUI_Command->run() /usr/share/PHP/PHPUnit/TextUI/Command.PHP:129 PHP 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/PHP/PHPUnit/TextUI/Command.PHP:188 PHP 5. PHP_CodeCoverage_Report_HTML->process() /usr/share/PHP/PHPUnit/TextUI/TestRunner.PHP:363 PHP 6. PHP_CodeCoverage_Report_HTML->addItems() /usr/share/PHP/PHP/CodeCoverage/Report/HTML.PHP:135 PHP 7. PHP_CodeCoverage_Report_HTML_Node_Directory->addFile() /usr/share/PHP/PHP/CodeCoverage/Report/HTML.PHP:214 PHP 8. PHP_CodeCoverage_Report_HTML_Node_File->__construct() /usr/share/PHP/PHP/CodeCoverage/Report/HTML/Node/Directory.PHP:156 PHP 9. PHP_CodeCoverage_Util::getLinesToBeIgnored() /usr/share/PHP/PHP/CodeCoverage/Report/HTML/Node/File.PHP:169 PHP 10. PHP_Token_Stream_CachingFactory::get() /usr/share/PHP/PHP/CodeCoverage/Util.PHP:271 Fatal error: Class 'PHP_Token_Stream' not found in /usr/share/PHP/PHP/Token/Stream/CachingFactory.PHP on line 68 Call Stack: 0.0002 326940 1. {main}() /usr/bin/PHPunit:0 0.0434 666604 2. PHPUnit_TextUI_Command::main() /usr/bin/PHPunit:49 0.0435 667084 3. PHPUnit_TextUI_Command->run() /usr/share/PHP/PHPUnit/TextUI/Command.PHP:129 0.0943 4312004 4. PHPUnit_TextUI_TestRunner->doRun() /usr/share/PHP/PHPUnit/TextUI/Command.PHP:188 1.1150 13272196 5. PHP_CodeCoverage_Report_HTML->process() /usr/share/PHP/PHPUnit/TextUI/TestRunner.PHP:363 1.1521 14100768 6. PHP_CodeCoverage_Report_HTML->addItems() /usr/share/PHP/PHP/CodeCoverage/Report/HTML.PHP:135 1.1521 14101320 7. PHP_CodeCoverage_Report_HTML_Node_Directory->addFile() /usr/share/PHP/PHP/CodeCoverage/Report/HTML.PHP:214 1.1521 14103132 8. PHP_CodeCoverage_Report_HTML_Node_File->__construct() /usr/share/PHP/PHP/CodeCoverage/Report/HTML/Node/Directory.PHP:156 1.1595 14122724 9. PHP_CodeCoverage_Util::getLinesToBeIgnored() /usr/share/PHP/PHP/CodeCoverage/Report/HTML/Node/File.PHP:169 1.1595 14123076 10. PHP_Token_Stream_CachingFactory::get() /usr/share/PHP/PHP/CodeCoverage/Util.PHP:271
您正在运行PHPUnit 3.5.x,因此可以使用以下命令安装所需的令牌流版本:
原文链接:https://www.f2er.com/php/135299.htmlsudo pear install --force --alldeps PHPunit/PHP_CodeCoverage-1.0.2
如果你想更新到当前版本的PHPunit那么单独的行
sudo pear install --force --alldeps PHPunit/PHPunit
将完成这项工作,但如果我没记错的话,你正在尝试使用Zend Framework测试环境并且只适用于PHPUnit 3.5.15
如果两个选项都失败或不适合
sudo pear install --force PHPunit/PHP_TokenStream
什么肯定会让你工作PHPUnit 3.5.15
http://dustyreagan.com/downgrade-phpunit-3-6-to-3-5-15/
重要说明:如果您通过PEAR安装PHPUnit.此安装方法不再
支持和http://pear.phpunit.de/将不迟于关闭
2014年12月31日.
请阅读http://phpunit.de/manual/current/en/installation.html和学习如何从PHAR使用PHPUnit或通过Composer安装它.