dmaicher / doctrine-test-bundle

Symfony bundle to isolate your app's doctrine database tests and improve the test performance
MIT License
1.08k stars 62 forks source link

Auto-register listener? #16

Closed garak closed 8 years ago

garak commented 8 years ago

I'm not really an expert of PHPUnit, but I see that Symfony's bridge is able to auto-register its listener. Maybe the same could be done here? Saving the user from manually editing their own PHPUnit config file.

dmaicher commented 8 years ago

Yes nice idea :wink:

I checked a bit and for me the SymfonyTestListener (https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/PhpUnit/SymfonyTestsListener.php) is not automatically registered. Its never instantiated/called for my TestSuite.

In the docs it says "... it automatically registers a PHPUnit event listener ..." (https://symfony.com/doc/current/components/phpunit_bridge.html#usage).

Maybe @nicolas-grekas can explain quickly how it should auto register the listener? :blush:

nicolas-grekas commented 8 years ago

The trick in Symfony is to use our own phpunit bootstrapper, see https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/PhpUnit/TextUI/TestRunner.php There is no other I'm aware of, and I don't think you should take this way either...

dmaicher commented 8 years ago

Thanks for the fast reply @nicolas-grekas! But then the listener is not automatically registered for user symfony applications by simply requiring the bridge via composer, right?