Skip to content

Commit 993fbad

Browse files
authored
Merge pull request #32 from getsentry/feature/better-app-paths
Improve app path handling
2 parents be00bc7 + 95b4549 commit 993fbad

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"php": ">=5.3.3",
16-
"sentry/sentry": ">=1.2.0",
16+
"sentry/sentry": ">=1.5.0",
1717
"symfony/symfony": ">=2.4.0"
1818
},
1919
"require-dev": {

src/Sentry/SentryBundle/DependencyInjection/Configuration.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getConfigTreeBuilder()
2323
$rootNode
2424
->children()
2525
->scalarNode('app_path')
26-
->defaultValue('%kernel.root_dir%')
26+
->defaultValue('%kernel.root_dir%/..')
2727
->end()
2828
->scalarNode('client')
2929
->defaultValue('Sentry\SentryBundle\SentrySymfonyClient')
@@ -50,6 +50,11 @@ public function getConfigTreeBuilder()
5050
->treatNullLike(array())
5151
->defaultValue(array('%kernel.root_dir%/..'))
5252
->end()
53+
->arrayNode('excluded_app_paths')
54+
->prototype('scalar')->end()
55+
->treatNullLike(array())
56+
->defaultValue(array('%kernel.root_dir%/../vendor'))
57+
->end()
5358
->end()
5459
;
5560

src/Sentry/SentryBundle/Resources/config/services.yml

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ services:
66
- [setRelease, ['%sentry.release%']]
77
- [setEnvironment, ['%sentry.environment%']]
88
- [setAppPath, ['%sentry.app_path%']]
9+
- [setExcludedAppPaths, ['%sentry.excluded_app_paths%']]
910
- [setPrefixes, ['%sentry.prefixes%']]
1011
- [install, []]
1112

test/Sentry/SentryBundle/Test/DependencyInjection/ExtensionTest.php

+12-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ class ExtensionTest extends \PHPUnit_Framework_TestCase
99
{
1010
const CONFIG_ROOT = 'sentry';
1111

12-
public function test_that_it_uses_kernel_root_as_app_path_by_default()
12+
public function test_that_it_uses_kernel_root_parent_as_app_path_by_default()
1313
{
1414
$container = $this->getContainer();
1515

1616
$this->assertSame(
17-
'kernel/root',
17+
'kernel/root/..',
1818
$container->getParameter('sentry.app_path')
1919
);
2020
}
@@ -33,6 +33,16 @@ public function test_that_it_uses_app_path_value()
3333
);
3434
}
3535

36+
public function test_vendor_in_default_excluded_paths()
37+
{
38+
$container = $this->getContainer();
39+
40+
$this->assertContains(
41+
'kernel/root/../vendor',
42+
$container->getParameter('sentry.excluded_app_paths')
43+
);
44+
}
45+
3646
public function test_that_it_uses_defined_class_as_client_class_by_default()
3747
{
3848
$container = $this->getContainer();

0 commit comments

Comments
 (0)