Closed
Description
Symfony version(s) affected: 4
Description
When installing Codeception in Symfony 4 with composer require "codeception/codeception" --dev
(as recommended at https://codeception.com/quickstart ), I'm getting this warning from composer:
Adding phpunit/phpunit as a dependency is discouraged in favor of Symfony's PHPUnit Bridge.
Plus this hint:
Instead:
1. Remove it now: composer remove --dev phpunit/phpunit
2. Use Symfony's bridge: composer require --dev phpunit
I already reported this as a possible Codeception issue, but received the answer that it's more a Symfony issue: Codeception/Codeception#4974
Activity
sinner commentedon May 18, 2018
I have the same problem but using Behat
nicolas-grekas commentedon May 18, 2018
We could solve this by allowing codeception/behat/etc. to be added on top of the phpunit that is built by the bridge.
This could be done by adding a SYMFONY_PHPUNIT_REQUIRE env var to configure the bridge (similar to SYMFONY_PHPUNIT_REMOVE).
Might need more thought to be made to work seamlessly with recipes.
zored commentedon Jun 7, 2018
I think we have a compatability problem here now because of
/bin/.phpunit/
and/vendor/
mix. Example:stof commentedon Jun 7, 2018
can you show the output of
composer show
so that we can see the versions of packages you have installed ?tonivdv commentedon Jun 12, 2018
I've got the exact same issue as @ThomasLandauer but with a different package. In my case I try to require https://github.com/martin-helmich/phpunit-json-assert which in their composer.json they have
When I do
composer require --dev helmich/phpunit-json-assert
in my sf4 project , I get the same as @ThomasLandauerBut it's only a warning as the tests work as expected.
Cheers
0xdfgp commentedon Jun 21, 2018
@stof Same problem here. This is my composer show output:
And the composer.json:
ghost commentedon Jun 22, 2018
Hi, we have the same problem here:
Here is the
composer show
output:And this is what we have in
composer.json
:Looking forward to some help on that topic.
nicolas-grekas commentedon Jun 23, 2018
You need to use the real phpunit script instead, which is at
./vendor/bin/phpunit
.xabbuh commentedon Jul 6, 2018
Is there anything we need to do here?
ostrolucky commentedon Jul 7, 2018
Well yes, this issue is about composer triggering the message when requiring libs relying on phpunit. @nicolas-grekas's comment solves different issue.
7 remaining items
Simperfit commentedon Apr 15, 2019
Does this stays in the won't fix or did you fix this with @greg0ire @nicolas-grekas ?
greg0ire commentedon Apr 15, 2019
I didn't continue working on that tool, but might if there is still a need, but apparently phpunit is starting to integrate with phpscoper: sebastianbergmann/phpunit#2015 (comment) this should fix autoloading conflict issues
nicolas-grekas commentedon Apr 15, 2019
phpunit is just one tool. The general issue remains: deps of tool should not mangle one deps. phpscoper won't really help here as ppl will still continue to use composer to control the version of their tools that their apps need.
Let's continue that require-tool we talked about :)
gnutix commentedon Nov 6, 2019
@nicolas-grekas Any news about this "require-tool" you're talking about ? I'm hitting the same issue with Rector and investigating into the state of this issue in the PHP community.
RSalo commentedon Jan 16, 2020
I have the same deprecation:
symfony/phpunit-bridge
rdohms/phpunit-arraysubset-asserts#30carsonbot commentedon Jan 17, 2021
Hey, thanks for your report!
There has not been a lot of activity here for a while. Is this bug still relevant? Have you managed to find a workaround?
ThomasLandauer commentedon Jan 18, 2021
@carsonbot :-) The issue is still relevant. The message was reworded in symfony/recipes#811 to:
dontub commentedon Jan 25, 2021
I'd appreciate a solution that allows to add custom dependencies on top of the phpunit installed by
simple-phpunit
like the one suggested in #27289 (comment) or #39387 (comment). In my case I'd like to use dms/phpunit-arraysubset-asserts as well as phpspec/prophecy-phpunit.nicolas-grekas commentedon Jan 26, 2021
I created composer/composer#9636 as a follow up of this issue.
I'm closing here as there is nothing specific to do in Symfony. All happens at the recipe level. It'd suggest opening a PR on the recipe repo if one wants to remove the warning. I don't know if/when we'll merge it, but at least that could be the tracker.
I really hope something like composer/composer#9636 will exist in the future to free us from a range of related issues.