From 3abf8267f339ec64e7a74ba92633250b52282d31 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 10 Aug 2017 13:07:56 +0200 Subject: [PATCH 1/2] Made some SecurityBundle tests case-insensitive to prepare for future Symfony versions --- .../DependencyInjection/CompleteConfigurationTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 87b8e30cbd8ba..26dbf12667690 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -81,6 +81,12 @@ public function testFirewalls() $configs[] = array_values($configDef->getArguments()); } + // transform all $configs values to lower case so tests are case-insensitive and + // they also work in newer Symfony versions where service IDs are case-sensitive + array_walk_recursive($configs, function (&$value) { + $value = is_string($value) ? strtolower($value) : $value; + }); + $this->assertEquals(array( array( 'simple', @@ -112,7 +118,7 @@ public function testFirewalls() ), array( 'parameter' => '_switch_user', - 'role' => 'ROLE_ALLOWED_TO_SWITCH', + 'role' => 'role_allowed_to_switch', ), ), array( From f2c6235b5aa4e0f2b3abfaaf8487ca9a0082cd2b Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 13 Aug 2017 18:55:36 +0200 Subject: [PATCH 2/2] Only lowercase the service IDs --- .../DependencyInjection/CompleteConfigurationTest.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php index 26dbf12667690..4f000d3aee0f8 100644 --- a/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php +++ b/src/Symfony/Bundle/SecurityBundle/Tests/DependencyInjection/CompleteConfigurationTest.php @@ -81,11 +81,10 @@ public function testFirewalls() $configs[] = array_values($configDef->getArguments()); } - // transform all $configs values to lower case so tests are case-insensitive and - // they also work in newer Symfony versions where service IDs are case-sensitive - array_walk_recursive($configs, function (&$value) { - $value = is_string($value) ? strtolower($value) : $value; - }); + // the IDs of the services are case sensitive or insensitive depending on + // the Symfony version. Transform them to lowercase to simplify tests. + $configs[0][2] = strtolower($configs[0][2]); + $configs[2][2] = strtolower($configs[2][2]); $this->assertEquals(array( array( @@ -118,7 +117,7 @@ public function testFirewalls() ), array( 'parameter' => '_switch_user', - 'role' => 'role_allowed_to_switch', + 'role' => 'ROLE_ALLOWED_TO_SWITCH', ), ), array(