Skip to content

Commit a313f49

Browse files
committed
add support of options in RB 1.6+
1 parent 054b548 commit a313f49

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

DependencyInjection/Configuration.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class Configuration implements ConfigurationInterface
2424
const ENVIRONMENT = 'production';
2525
const TIMEOUT = 3;
2626

27-
const API_ENDPOINT = 'https://api.rollbar.com/api/1/';
27+
const API_ENDPOINT = 'https://api.rollbar.com/api/1/';
28+
const PHP_MAX_ITEMS = 10;
2829

2930
const JS_ITEMS_PER_MINUTE = 60;
3031
const JS_MAX_ITEMS = 0;
@@ -87,6 +88,7 @@ public function getConfigTreeBuilder()
8788
->defaultValue('%kernel.logs_dir%/rollbar.log')
8889
->end()
8990
->booleanNode('allow_exec')->defaultTrue()->end()
91+
->booleanNode('autodetect_branch')->defaultFalse()->end()
9092
->scalarNode('endpoint')->defaultValue(static::API_ENDPOINT)->end()
9193
->scalarNode('base_api_url')->defaultValue(static::API_ENDPOINT)->end()
9294
->scalarNode('branch')->defaultValue(static::BRANCH)->end()
@@ -166,6 +168,8 @@ public function getConfigTreeBuilder()
166168
->booleanNode('send_message_trace')->defaultFalse()->end()
167169
->booleanNode('include_raw_request_body')->defaultFalse()->end()
168170
->booleanNode('local_vars_dump')->defaultTrue()->end()
171+
->scalarNode('max_nesting_depth')->defaultValue(-1)->end()
172+
->scalarNode('max_items')->defaultValue(static::PHP_MAX_ITEMS)->end()
169173
->end()
170174
->end()
171175
->arrayNode('rollbar_js')->children()

Tests/SymfonyRollbarBundle/DependencyInjection/ConfigurationTest.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace SymfonyRollbarBundle\Tests\DependencyInjection;
44

5+
use Rollbar\Config;
56
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
67
use SymfonyRollbarBundle\DependencyInjection\Configuration;
78
use SymfonyRollbarBundle\DependencyInjection\SymfonyRollbarExtension;
@@ -53,6 +54,7 @@ public function testParameters()
5354
'agent_log_location' => static::$kernel->getLogDir() . '/rollbar.log',
5455
'base_api_url' => Configuration::API_ENDPOINT,
5556
'branch' => Configuration::BRANCH,
57+
'autodetect_branch' => false,
5658
'capture_error_stacktraces' => true,
5759
'check_ignore' => '\SymfonyRollbarBundle\Tests\Fixtures\CheckIgnoreProvider',
5860
'code_version' => '',
@@ -93,7 +95,8 @@ public function testParameters()
9395
'ca_cert_path' => null,
9496
'transformer' => null,
9597
'verbosity' => 'error',
96-
98+
'max_nesting_depth' => -1,
99+
'max_items' => Configuration::PHP_MAX_ITEMS,
97100
],
98101
'rollbar_js' => [
99102
'access_token' => 'SOME_ROLLBAR_ACCESS_TOKEN_654321',
@@ -127,4 +130,21 @@ public function testEmptyConfiguration()
127130
$this->assertArrayHasKey('exclude', $config);
128131
$this->assertArrayHasKey('rollbar', $config);
129132
}
133+
134+
public function testCompareRollbarDefaults()
135+
{
136+
static::bootKernel();
137+
$container = static::$kernel->getContainer();
138+
139+
$config = $container->getParameter(SymfonyRollbarExtension::ALIAS . '.config');
140+
$rbConfig = Config::listOptions();
141+
142+
foreach ($rbConfig as $key) {
143+
if ($key === 'enabled') {
144+
continue;
145+
}
146+
147+
$this->assertArrayHasKey($key, $config['rollbar']);
148+
}
149+
}
130150
}

Tests/SymfonyRollbarBundle/DependencyInjection/SymfonyRollbarExtensionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function generatorConfigVars()
5252
'agent_log_location' => '%kernel.logs_dir%/rollbar.log',
5353
'base_api_url' => 'https://api.rollbar.com/api/1/',
5454
'branch' => Configuration::BRANCH,
55+
'autodetect_branch' => false,
5556
'capture_error_stacktraces' => true,
5657
'check_ignore' => null,
5758
'code_version' => '',
@@ -92,6 +93,8 @@ public function generatorConfigVars()
9293
'ca_cert_path' => null,
9394
'transformer' => null,
9495
'verbosity' => 'error',
96+
'max_nesting_depth' => -1,
97+
'max_items' => Configuration::PHP_MAX_ITEMS,
9598
],
9699
];
97100

0 commit comments

Comments
 (0)