From d59848225e5ae5e34e2a1ec3a31cc558ded2900a Mon Sep 17 00:00:00 2001 From: Jeroen Thora Date: Mon, 19 Jul 2021 21:49:51 +0200 Subject: [PATCH] [AdminBundle] Fix remaining usages of deprecated admin_exception_excludes config --- .../KunstmaanAdminExtension.php | 3 +- .../KunstmaanAdminExtensionTest.php | 45 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php b/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php index 35d0a37119..601d40d3bb 100644 --- a/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php +++ b/src/Kunstmaan/AdminBundle/DependencyInjection/KunstmaanAdminExtension.php @@ -60,7 +60,8 @@ public function load(array $configs, ContainerBuilder $container) $container->setParameter('kunstmaan_admin.admin_prefix', $this->normalizeUrlSlice($config['admin_prefix'])); - $container->setParameter('kunstmaan_admin.admin_exception_excludes', $config['admin_exception_excludes']); + $exceptionExcludes = !empty($config['exception_logging']['exclude_patterns']) ? $config['exception_logging']['exclude_patterns'] : $config['admin_exception_excludes']; + $container->setParameter('kunstmaan_admin.admin_exception_excludes', $exceptionExcludes); $container->setParameter('kunstmaan_admin.google_signin.enabled', $config['google_signin']['enabled']); $container->setParameter('kunstmaan_admin.google_signin.client_id', $config['google_signin']['client_id']); diff --git a/src/Kunstmaan/AdminBundle/Tests/DependencyInjection/KunstmaanAdminExtensionTest.php b/src/Kunstmaan/AdminBundle/Tests/DependencyInjection/KunstmaanAdminExtensionTest.php index 30168b6055..520bf1f35c 100644 --- a/src/Kunstmaan/AdminBundle/Tests/DependencyInjection/KunstmaanAdminExtensionTest.php +++ b/src/Kunstmaan/AdminBundle/Tests/DependencyInjection/KunstmaanAdminExtensionTest.php @@ -180,6 +180,51 @@ public function testLegacyParameters() $this->assertContainerBuilderHasParameter('kunstmaan_admin.default_locale', ''); } + /** + * @group legacy + */ + public function testDeprecatedExceptionExcludes() + { + $this->load(array_merge($this->getRequiredConfig(), [ + 'authentication' => [ + 'enable_new_authentication' => true, + ], + 'admin_exception_excludes' => [ + 'test_exclude', + ], + ])); + + $this->assertContainerBuilderHasParameter('kunstmaan_admin.admin_exception_excludes', ['test_exclude']); + } + + /** + * @group legacy + */ + public function testDeprecatedExceptionExcludesWithNewConfig() + { + $this->load(array_merge($this->getRequiredConfig(), [ + 'admin_exception_excludes' => [ + 'test_exclude', + ], + 'exception_logging' => [ + 'exclude_patterns' => ['test_exclude_new_config'], + ], + ])); + + $this->assertContainerBuilderHasParameter('kunstmaan_admin.admin_exception_excludes', ['test_exclude_new_config']); + } + + public function testExceptionExcludesFromExceptionLoggingConfig() + { + $this->load(array_merge($this->getRequiredConfig(), [ + 'exception_logging' => [ + 'exclude_patterns' => ['test_exclude_new_config'], + ], + ])); + + $this->assertContainerBuilderHasParameter('kunstmaan_admin.admin_exception_excludes', ['test_exclude_new_config']); + } + protected function setUp(): void { parent::setUp();