diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 5c84e7f9..ab4f3da7 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -35,7 +35,7 @@ public function getConfigTreeBuilder() $root = $tb->root('jms_serializer')->children(); } - $root->booleanNode('profiler')->defaultTrue($this->debug)->end(); + $root->booleanNode('profiler')->defaultValue($this->debug)->end(); $this->addHandlersSection($root); $this->addSubscribersSection($root); diff --git a/Tests/DependencyInjection/ConfigurationTest.php b/Tests/DependencyInjection/ConfigurationTest.php index f3f5ebd9..484a162b 100644 --- a/Tests/DependencyInjection/ConfigurationTest.php +++ b/Tests/DependencyInjection/ConfigurationTest.php @@ -282,4 +282,17 @@ public function testJsonSerializationVisitorDefaultOptions() $this->assertEquals(1024 /*JSON_PRESERVE_ZERO_FRACTION*/, $config['visitors']['json_serialization']['options']); } + + public function testDefaultProfiler() + { + $processor = new Processor(); + $config = $processor->processConfiguration(new Configuration(true), []); + + $this->assertSame(true, $config['profiler']); + + $processor = new Processor(); + $config = $processor->processConfiguration(new Configuration(false), []); + + $this->assertSame(false, $config['profiler']); + } }