Skip to content

Commit 844af0c

Browse files
authored
Merge pull request #21 from OxCom/develop
Extended configuration
2 parents 054b548 + a757f3e commit 844af0c

File tree

5 files changed

+49
-3
lines changed

5 files changed

+49
-3
lines changed

.travis.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ matrix:
1010
env: SYMFONY_VERSION=^2.8
1111
- php: 7.2
1212
env: SYMFONY_VERSION=^2.8
13+
- php: 7.3
14+
env: SYMFONY_VERSION=^2.8
15+
1316
- php: 5.6
1417
env: SYMFONY_VERSION=~3.0
1518
- php: 7.0
@@ -18,6 +21,9 @@ matrix:
1821
env: SYMFONY_VERSION=~3.0
1922
- php: 7.2
2023
env: SYMFONY_VERSION=~3.0
24+
- php: 7.3
25+
env: SYMFONY_VERSION=~3.0
26+
2127
- php: 5.6
2228
env: SYMFONY_VERSION=~3.4
2329
- php: 7.0
@@ -26,18 +32,27 @@ matrix:
2632
env: SYMFONY_VERSION=~3.4
2733
- php: 7.2
2834
env: SYMFONY_VERSION=~3.4
29-
- php: 7.1
35+
- php: 7.3
36+
3037
env: SYMFONY_VERSION=~4.0
3138
- php: 7.2
3239
env: SYMFONY_VERSION=~4.0
40+
- php: 7.3
41+
env: SYMFONY_VERSION=~4.0
42+
3343
- php: 7.1
3444
env: SYMFONY_VERSION=~4.1
3545
- php: 7.2
3646
env: SYMFONY_VERSION=~4.1
47+
- php: 7.3
48+
env: SYMFONY_VERSION=~4.1
49+
3750
- php: 7.1
3851
env: SYMFONY_VERSION=~4.2
3952
- php: 7.2
4053
env: SYMFONY_VERSION=~4.2
54+
- php: 7.3
55+
env: SYMFONY_VERSION=~4.2
4156

4257
before_install:
4358
- curl -s https://getcomposer.org/installer | php

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

Tests/SymfonyRollbarBundle/Provider/RollbarHandlerTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ public function testInitialize()
320320
'agent_log_location' => static::$kernel->getLogDir() . '/rollbar.log',
321321
'base_api_url' => Configuration::API_ENDPOINT,
322322
'branch' => Configuration::BRANCH,
323+
'autodetect_branch' => false,
323324
'capture_error_stacktraces' => true,
324325
'check_ignore' => [
325326
new \SymfonyRollbarBundle\Tests\Fixtures\CheckIgnoreProvider(),
@@ -367,6 +368,9 @@ public function testInitialize()
367368
'transformer' => null,
368369
'verbosity' => 'error',
369370
'framework' => 'Symfony ' . \Symfony\Component\HttpKernel\Kernel::VERSION,
371+
'max_nesting_depth' => -1,
372+
'max_items' => Configuration::PHP_MAX_ITEMS,
373+
370374
];
371375

372376
$this->assertEquals($default, $config);

0 commit comments

Comments
 (0)