|
3 | 3 | namespace Sentry\SentryBundle\Test; |
4 | 4 |
|
5 | 5 | use PHPUnit\Framework\TestCase; |
| 6 | +use Sentry\Integration\ErrorListenerIntegration; |
| 7 | +use Sentry\Integration\ExceptionListenerIntegration; |
| 8 | +use Sentry\Integration\IntegrationInterface; |
| 9 | +use Sentry\Integration\RequestIntegration; |
6 | 10 | use Sentry\SentryBundle\DependencyInjection\SentryExtension; |
7 | 11 | use Sentry\SentryBundle\EventListener\ConsoleListener; |
8 | 12 | use Sentry\SentryBundle\EventListener\ErrorListener; |
9 | 13 | use Sentry\SentryBundle\EventListener\RequestListener; |
10 | 14 | use Sentry\SentryBundle\EventListener\SubRequestListener; |
| 15 | +use Sentry\State\HubInterface; |
11 | 16 | use Symfony\Component\Console\ConsoleEvents; |
12 | 17 | use Symfony\Component\DependencyInjection\ContainerBuilder; |
13 | 18 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
@@ -116,10 +121,23 @@ public function testContainerHasErrorListenerConfiguredCorrectly(): void |
116 | 121 | $this->assertSame($expectedTag, $consoleListener->getTags()); |
117 | 122 | } |
118 | 123 |
|
| 124 | + public function testIntegrationsListenersAreDisabledByDefault(): void |
| 125 | + { |
| 126 | + $container = $this->getContainer(); |
| 127 | + |
| 128 | + $hub = $container->get(HubInterface::class); |
| 129 | + |
| 130 | + $this->assertInstanceOf(HubInterface::class, $hub); |
| 131 | + $this->assertInstanceOf(IntegrationInterface::class, $hub->getIntegration(RequestIntegration::class)); |
| 132 | + $this->assertNull($hub->getIntegration(ErrorListenerIntegration::class)); |
| 133 | + $this->assertNull($hub->getIntegration(ExceptionListenerIntegration::class)); |
| 134 | + } |
| 135 | + |
119 | 136 | private function getContainer(array $configuration = []): ContainerBuilder |
120 | 137 | { |
121 | 138 | $containerBuilder = new ContainerBuilder(); |
122 | 139 | $containerBuilder->setParameter('kernel.root_dir', 'kernel/root'); |
| 140 | + $containerBuilder->setParameter('kernel.cache_dir', 'var/cache'); |
123 | 141 | if (method_exists(Kernel::class, 'getProjectDir')) { |
124 | 142 | $containerBuilder->setParameter('kernel.project_dir', '/dir/project/root'); |
125 | 143 | } |
|
0 commit comments