我在我的 Symfony 项目中使用PHPUnit Bridge 。我目前正在使用 PHPUnit 7,我想升级到 PHPUnit 8。
在 PHPUnit 8中,数组子集断言已被弃用并生成警告。我想使用dms/phpunit-arraysubset-asserts 包来提供它们。使用常规的 PHPUnit,我只需composer require
它并称之为一天。
现在,Bridge 没有原始的 PHPUnit 作为其依赖项,而是将其安装到一个临时文件夹,对其进行修补并从那里运行。phpunit-arraysubset-asserts 具有 PHPUnit 依赖项,但会生成警告:
Adding phpunit/phpunit as a dependency is discouraged in favor of Symfony's PHPUnit Bridge.
* Instead:
1. Remove it now: composer remove --dev phpunit/phpunit
2. Use Symfony's bridge: composer require --dev phpunit
我不想安装phpunit/phpunit
以避免混淆。
我试图通过添加替换来忽略它*
,但只是添加替换会composer.json
产生 Composer 错误:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- __root__ No version set (parsed as 1.0.0) conflicts with symfony/phpunit-bridge[v5.0.5].
- symfony/phpunit-bridge v5.0.5 conflicts with __root__[No version set (parsed as 1.0.0)].
- Installation request for __root__ No version set (parsed as 1.0.0) -> satisfiable by __root__[No version set (parsed as 1.0.0)].
- Installation request for symfony/phpunit-bridge v5.0.5 -> satisfiable by symfony/phpunit-bridge[v5.0.5].
使用 PHPUnit Bridge 时添加 PHPUnit 扩展的正确方法是什么?