Installing package by composer breaks Symfony4 unit testing
Closed this issue · 2 comments
clauculo commented
When requiring spatie/phpunit-snapshot-assertions --dev package by composer the unit tests of Symfony breaks.
Output:
Fatal error: Declaration of Symfony\Bridge\PhpUnit\Legacy\SymfonyTestsListenerForV7::addError(PHPUnit\Framework\Test $test, Throwable $t, float $time): void must be compatible with PHPUnit\Framework\TestListener::addError(PHPUnit\Framework\Test $test, Exception $e, $time) in /var/www/html/vendor/symfony/phpunit-bridge/Legacy/SymfonyTestsListenerForV7.php on line 27
I've tried a couple of things
- Remove vendor dir and install everything again
- Remove vendor dir and run composer update
- Remove vendor dir and load older version (1.2.3)
I guess there is a conflict in the PHP-Unit Bridge and another package.
Our package list:
"require": {
"php": ">=7.1",
"aws/aws-sdk-php": "^3.24",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"doctrine/orm": "^2.5",
"firebase/php-jwt": "^5.0",
"guzzlehttp/guzzle": "^6.3",
"harmbandstra/swagger-ui-bundle": "^3.0",
"knplabs/doctrine-behaviors": "~1.1",
"league/fractal": "master@dev",
"myclabs/php-enum": "^1.6",
"nelmio/cors-bundle": "^1.5",
"sensio/framework-extra-bundle": "^5.1",
"stof/doctrine-extensions-bundle": "^1.3",
"symfony/asset": "^4.0",
"symfony/flex": "^1.0",
"symfony/form": "^4.0",
"symfony/monolog-bundle": "^3.1",
"symfony/orm-pack": "^1.0",
"symfony/polyfill-apcu": "^1.0",
"symfony/security-bundle": "^4.0",
"symfony/serializer-pack": "^1.0",
"symfony/swiftmailer-bundle": "^3.1",
"symfony/translation": "^4.0",
"symfony/twig-bundle": "^4.0",
"symfony/validator": "^4.0",
"symfony/yaml": "^4.0",
"white-october/pagerfanta-bundle": "^1.1"
},
"require-dev": {
"doctrine/doctrine-fixtures-bundle": "^3.0",
"spatie/phpunit-snapshot-assertions": "^1.2",
"symfony/browser-kit": "^4.0",
"symfony/dotenv": "^4.0",
"symfony/phpunit-bridge": "^4.0",
"symfony/profiler-pack": "^1.0"
},
Ps. Good useful package! Thanks a lot for maintaining this. (In our old office it works perfect)
sebastiandedeyne commented
I suggest you open an issue in the Bridge package. While this package might trigger different version requirements, it's their responsibility to ensure they only allow specific versions.
ebuildy commented
Installing the package, I got warning:
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
Do you have an example of usage with Symfony 4 please?