Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,18 @@ public function getConfigTreeBuilder()
->arrayNode('skip_capture')
->prototype('scalar')->end()
->defaultValue([HttpExceptionInterface::class])
->validate()
->ifTrue(function (array $classes) {
foreach ($classes as $class) {
if (! class_exists($class)) {
return true;
}
}

return false;
})
->thenInvalid('Unknown classes passed to skip_capture')
->end()
->end()
->arrayNode('listener_priorities')
->addDefaultsIfNotSet()
Expand Down
18 changes: 15 additions & 3 deletions test/DependencyInjection/SentryExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,19 +201,31 @@ public function test_that_it_uses_exception_listener_value()
);
}

public function test_skip_capture_classes_exist()
{
$this->expectException(InvalidConfigurationException::class);

$this->getContainer(
[
'skip_capture' => [
'ThisClassDoesNotExist',
],
]
);
}

public function test_that_it_uses_skipped_capture_value()
{
$container = $this->getContainer(
[
'skip_capture' => [
'classA',
'classB',
self::class,
],
]
);

$this->assertSame(
['classA', 'classB'],
[self::class],
$container->getParameter('sentry.skip_capture')
);
}
Expand Down