I’m trying to use Sentry with Symfony.
Everything works fine, except for tests with Phpunit.

Since I activated Sentry, I get a notice / error after my tests execute : THE ERROR HANDLER HAS CHANGED!

Found a post here saying that the guy has to disable sentry in test env to fix that (which seems OK).

How may I do this ? Is there a config.yml instruction that may disable it (to be placed in the config_test.yml for instance) ? Some other way ?

Best regards



It looks like someone else had the same troubles.

You can leave the dsn empty in your test environment configs and it will not enable.


Thanks for your answer.

Unfortunately, I’ve tried that, but I still get the error.

Any other idea ?


Yeah we still install the error handler either way. The only real option you have is to simply not instantiate it (or don’t call install())


Only load sentry in prod environment:

In AppKernel::registerBundles:

    if ($this->getEnvironment() == 'prod') {
        $bundles[] = new SentryBundle();

move the sentry config from config.yml into config_prod.yml.

Of course, you won’t be able to set extra context with this method.