Skip to content

[DoctrineBridge] Possible event listener related problem and BC break in latest 5.x branch #40268

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ostrolucky opened this issue Feb 21, 2021 · 1 comment

Comments

@ostrolucky
Copy link
Contributor

Symfony version(s) affected: 5.x@d24315fe3174ae9f7fd3bbcdc864825ac75c8ceb

Description
Since symfony/doctrine-bridge@d24315f, doctrine-bundle unit tests are failing with following:

❯ ./vendor/bin/phpunit
PHPUnit 9.5.2 by Sebastian Bergmann and contributors.

Warning:       Your XML configuration validates against a deprecated schema.
Suggestion:    Migrate your XML configuration using "--migrate-configuration"!

Testing
....................................................S..........  63 / 253 ( 24%)
............................................................... 126 / 253 ( 49%)
...........................F................................... 189 / 253 ( 74%)
...........F................................................... 252 / 253 ( 99%)
.                                                               253 / 253 (100%)

Time: 00:08.382, Memory: 54.50 MB

There were 2 failures:

1) Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\XmlDoctrineExtensionTest::testAttachEntityListenersTwoConnections
Method 'addEventListener' is expected to be called once, definition does not contain a call though.

/Users/gabriel.ostrolucky/Documents/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php:1265
/Users/gabriel.ostrolucky/Documents/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php:1024

2) Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection\YamlDoctrineExtensionTest::testAttachEntityListenersTwoConnections
Method 'addEventListener' is expected to be called once, definition does not contain a call though.

/Users/gabriel.ostrolucky/Documents/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php:1265
/Users/gabriel.ostrolucky/Documents/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php:1024

FAILURES!
Tests: 253, Assertions: 1002, Failures: 2, Skipped: 1.

How to reproduce

git clone git@github.com:doctrine/DoctrineBundle.git
cd DoctrineBundle
composer install
./vendor/bin/phpunit

Issue does not happen on 5.2 branch. So perhaps some wrongly resolved merge conflict?

@jderusse
Copy link
Member

Closing this issue, has this is not a bug in Symfony.

The test you are pointing is wrong: it expect the Definition to contains a call to the method addEventListener which is not the case since #40042:

The list of eventListeners are injected in the EventManager's constructor. The call to the method addEventListener will be performed in a lazy way at runtime (and not by the DiC as expected by the Doctrine's test.)

ostrolucky added a commit to doctrine/DoctrineBundle that referenced this issue Feb 21, 2021
Newest doctrine-bridge does not add these listeners via method calls, but via constructor

symfony/symfony#40268 (comment)
ostrolucky added a commit to doctrine/DoctrineBundle that referenced this issue Feb 21, 2021
Newest doctrine-bridge does not add these listeners via method calls, but via constructor

symfony/symfony#40268 (comment)
ostrolucky added a commit to doctrine/DoctrineBundle that referenced this issue Feb 21, 2021
Newest doctrine-bridge does not add these listeners via method calls, but via constructor

symfony/symfony#40268 (comment)
ostrolucky added a commit to doctrine/DoctrineBundle that referenced this issue Feb 21, 2021
Newest doctrine-bridge does not add these listeners via method calls, but via constructor

symfony/symfony#40268 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants