我正在用一个简单的灯堆运行一个流浪盒。我已经通过composer全局安装了phpunit:
composer global require "phpunit/phpunit=4.1.*"
当我运行phpunit时出现以下错误:
PHP Warning: require_once(PHP/CodeCoverage/Filter.php): failed to open stream: No such file or directory in /usr/share/php/PHPUnit/Autoload.php on line 46
HP Fatal error: require_once(): Failed opening required 'PHP/CodeCoverage/Filter.php' (include_path='/home/vagrant/.composer/vendor/phpunit/php-text-template:/home/vagrant/.composer/vendor/phpunit/phpunit-mock-objects:/home/vagrant/.composer/vendor/phpunit/php-timer:/home/vagrant/.composer/vendor/phpunit/php-token-stream:/home/vagrant/.composer/vendor/phpunit/php-file-iterator:/home/vagrant/.composer/vendor/phpunit/php-code-coverage:/home/vagrant/.composer/vendor/phpunit/phpunit:/home/vagrant/.composer/vendor/symfony/yaml:.:/usr/share/php:/usr/share/pear') in /usr/share/php/PHPUnit/Autoload.php on line 46
我的研究似乎暗示CodeCoverage无法安装是一个问题,但我在尝试安装时遇到了问题。我试图通过作曲家进行安装,但却无法正常工作。
通过Composer,我尝试添加到全局:
composer global require "phpunit/php-code-coverage": "3.0.*@dev"
我得到了这个输出:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- The requested package phpunit/php-code-coverage could not be found in any version, there may be a typo in the package name.
Problem 2
- phpunit/phpunit 4.1.3 requires phpunit/php-code-coverage ~2.0 -> no matching package found.
- phpunit/phpunit 4.1.3 requires phpunit/php-code-coverage ~2.0 -> no matching package found.
- Installation request for phpunit/phpunit == 4.1.3.0 -> satisfiable by phpunit/phpunit[4.1.3].
Potential causes:
- A typo in the package name
- The package is not available in a stable-enough version according to your minimum-stability setting
see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.
Read <http://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.
Installation failed, reverting ./composer.json to its original content.
不知道我做错了什么!
答案 0 :(得分:2)
您需要先重新安装代码覆盖率2.0
composer global require&#34; phpunit / php-code-coverage&#34;:&#34; 2.0。* @ dev&#34;
然后你安装phpunit
composer global require&#34; phpunit / phpunit = 4.1。*&#34;