我无法在 WAMP 上使用 PHP 5.6 使用 composer 升级 PHPUnit 5
I can't upgrade PHPUnit 5 with composer using PHP 5.6 on WAMP
我有 PHPUnit v4.7,我试图升级到 v5。那么为什么没有安装代码覆盖率,我该如何解决呢?我已经尝试完全删除 phpunit 文件夹。我正在使用 https://phpunit.de/getting-started/phpunit-5.html
中的安装命令
这是我的输出:
c:\[path to]\composer require --dev phpunit/phpunit ^5
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for phpunit/phpunit 5 -> satisfiable by phpunit/phpunit[5.0.0].
- Conclusion: don't install phpunit/php-code-coverage 2.2.4
- phpunit/phpunit 5.0.0 requires phpunit/php-code-coverage ~3.0 -> satisfiable by phpunit/php-code-coverage[3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.3.0, 3.3.1, 3.3.2, 3.3.3].
- Can only install one of: phpunit/php-code-coverage[3.0.0, 2.2.4].
... <repeated with more versions>
- Can only install one of: phpunit/php-code-coverage[3.3.3, 2.2.4].
- Installation request for phpunit/php-code-coverage (locked at 2.2.4) -> satisfiable by phpunit/php-code-coverage[2.2.4].
Installation failed, reverting ./composer.json to its original content.
更新:这是我的 composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "^5.0",
"adamwathan/bootforms": "@dev",
"patricktalmadge/bootstrapper": "~5",
"frozennode/administrator": "^5.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "^5",
"laracasts/integrated": "^0.15.6"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
您的 phpunit/php-code-coverage
已经锁定在 2.2.4
(检查 composer.lock
需要 phpunit/phpunit
~4
(参见:composer show -a phpunit/php-code-coverage 2.2.4
),并且您正在尝试安装 phpunit/phpunit
5
.
现在,phpunit/phpunit
5.0.0
需要 phpunit/php-code-coverage ~3.0
:
$ composer show -a phpunit/phpunit 5.0.0 | grep coverage
phpunit/php-code-coverage ~3.0
您的锁定版本是 2.2.4
,并且您不能同时拥有(3.3.3
、2.2.4
)。
查看特定包被锁定的原因,运行:
composer why -t phpunit/php-code-coverage
注意:也可以在末尾加一个version/constraint。
所以你可以尝试:
通过以下方式更新现有软件包以及所有依赖项:
composer update --with-dependencies
更新失败的特定包:
composer update phpunit/php-code-coverage --with-dependencies
删除 composer.lock
并通过以下方式重新安装所有软件包:
composer install
要查看当前的依赖关系树,运行:
composer show -t
另请参阅:
- How to resolve a "Can only install one of:" conflict?
我有 PHPUnit v4.7,我试图升级到 v5。那么为什么没有安装代码覆盖率,我该如何解决呢?我已经尝试完全删除 phpunit 文件夹。我正在使用 https://phpunit.de/getting-started/phpunit-5.html
中的安装命令这是我的输出:
c:\[path to]\composer require --dev phpunit/phpunit ^5
./composer.json has been updated
> php artisan clear-compiled
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- Installation request for phpunit/phpunit 5 -> satisfiable by phpunit/phpunit[5.0.0].
- Conclusion: don't install phpunit/php-code-coverage 2.2.4
- phpunit/phpunit 5.0.0 requires phpunit/php-code-coverage ~3.0 -> satisfiable by phpunit/php-code-coverage[3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.3.0, 3.3.1, 3.3.2, 3.3.3].
- Can only install one of: phpunit/php-code-coverage[3.0.0, 2.2.4].
... <repeated with more versions>
- Can only install one of: phpunit/php-code-coverage[3.3.3, 2.2.4].
- Installation request for phpunit/php-code-coverage (locked at 2.2.4) -> satisfiable by phpunit/php-code-coverage[2.2.4].
Installation failed, reverting ./composer.json to its original content.
更新:这是我的 composer.json
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.0.*",
"illuminate/html": "^5.0",
"adamwathan/bootforms": "@dev",
"patricktalmadge/bootstrapper": "~5",
"frozennode/administrator": "^5.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "^5",
"laracasts/integrated": "^0.15.6"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
],
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
]
},
"config": {
"preferred-install": "dist"
}
}
您的 phpunit/php-code-coverage
已经锁定在 2.2.4
(检查 composer.lock
需要 phpunit/phpunit
~4
(参见:composer show -a phpunit/php-code-coverage 2.2.4
),并且您正在尝试安装 phpunit/phpunit
5
.
现在,phpunit/phpunit
5.0.0
需要 phpunit/php-code-coverage ~3.0
:
$ composer show -a phpunit/phpunit 5.0.0 | grep coverage
phpunit/php-code-coverage ~3.0
您的锁定版本是 2.2.4
,并且您不能同时拥有(3.3.3
、2.2.4
)。
查看特定包被锁定的原因,运行:
composer why -t phpunit/php-code-coverage
注意:也可以在末尾加一个version/constraint。
所以你可以尝试:
通过以下方式更新现有软件包以及所有依赖项:
composer update --with-dependencies
更新失败的特定包:
composer update phpunit/php-code-coverage --with-dependencies
删除
composer.lock
并通过以下方式重新安装所有软件包:composer install
要查看当前的依赖关系树,运行:
composer show -t
另请参阅:
- How to resolve a "Can only install one of:" conflict?