diff --git a/src/Sentry/SentryBundle/DependencyInjection/SentryExtension.php b/src/Sentry/SentryBundle/DependencyInjection/SentryExtension.php index d6031106..e400fac4 100644 --- a/src/Sentry/SentryBundle/DependencyInjection/SentryExtension.php +++ b/src/Sentry/SentryBundle/DependencyInjection/SentryExtension.php @@ -71,7 +71,11 @@ private function checkConfigurationOnForInvalidSettings(array $config, Container } // both are used - if ($config[$option] !== $default && $config['options'][$option] !== $default) { + if ( + $config[$option] !== $default + && $config['options'][$option] !== $default + && $config['options'][$option] !== $config[$option] + ) { $message = sprintf( 'You are using both the deprecated option sentry.%s and the new sentry.options.%s, but values do not match. Drop the deprecated one or make the values identical.', $option, diff --git a/test/DependencyInjection/ExtensionTest.php b/test/DependencyInjection/SentryExtensionTest.php similarity index 93% rename from test/DependencyInjection/ExtensionTest.php rename to test/DependencyInjection/SentryExtensionTest.php index a2d3ff99..f3d2f87b 100644 --- a/test/DependencyInjection/ExtensionTest.php +++ b/test/DependencyInjection/SentryExtensionTest.php @@ -5,7 +5,7 @@ use Sentry\SentryBundle\DependencyInjection\SentryExtension; use Symfony\Component\DependencyInjection\ContainerBuilder; -class ExtensionTest extends \PHPUnit_Framework_TestCase +class SentryExtensionTest extends \PHPUnit_Framework_TestCase { const CONFIG_ROOT = 'sentry'; @@ -52,6 +52,38 @@ public function test_that_it_uses_app_path_value() ); } + public function test_that_it_uses_both_new_and_deprecated_values() + { + $container = $this->getContainer( + array( + static::CONFIG_ROOT => array( + 'app_path' => 'sentry/app/path', + 'options' => array('app_path' => 'sentry/app/path'), + ), + ) + ); + + $options = $container->getParameter('sentry.options'); + $this->assertSame( + 'sentry/app/path', + $options['app_path'] + ); + } + + public function test_that_throws_exception_if_new_and_deprecated_values_dont_match() + { + $this->setExpectedException('Symfony\Component\Config\Definition\Exception\InvalidConfigurationException'); + + $this->getContainer( + array( + 'app_path' => 'sentry/app/path', + static::CONFIG_ROOT => array( + 'options' => array('app_path' => 'sentry/different/app/path'), + ), + ) + ); + } + public function test_vendor_in_deprecated_default_excluded_paths() { $container = $this->getContainer();