Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[factory] fix cannot replace argument excption. use addArguments.

  • Loading branch information...
commit e295f7f3200eaa442ab435a67720f9e0afda2ba7 1 parent ba4aa29
Maksim Kotlyar makasim authored
10 DependencyInjection/Security/Factory/OpenIdFactory.php
View
@@ -93,13 +93,9 @@ protected function createAuthProvider(ContainerBuilder $container, $id, $config,
// with user provider
if (isset($config['provider'])) {
$provider
- //TODO: correctrly use addArgument instead of replaceArgument but this doesn't work
-// ->addArgument(new Reference($userProviderId))
-// ->addArgument(new Reference('security.user_checker'))
-// ->addArgument($config['create_user_if_not_exists'])
- ->replaceArgument(1, new Reference($userProviderId))
- ->replaceArgument(2, new Reference('security.user_checker'))
- ->replaceArgument(3, $config['create_user_if_not_exists'])
+ ->addArgument(new Reference($userProviderId))
+ ->addArgument(new Reference('security.user_checker'))
+ ->addArgument($config['create_user_if_not_exists'])
;
}
17 Tests/DependencyInjection/Security/Factory/OpenIdFactoryTest.php
View
@@ -318,16 +318,17 @@ public function shouldAddProviderKeyUserManagerUserCheckerAndWhetherCreateUserOr
$providerDefinition = $containerBuilder->getDefinition($providerId);
- $this->assertCount(4, $providerDefinition->getArguments());
-
- $this->assertEquals($expectedProviderKey, $providerDefinition->getArgument(0));
+ $arguments = $providerDefinition->getArguments();
+ $this->assertCount(4, $arguments);
+
+ $this->assertEquals($expectedProviderKey, $arguments['index_0']);
- $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $providerDefinition->getArgument(1));
- $this->assertEquals($expectedUserProviderId, (string) $providerDefinition->getArgument(1));
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[0]);
+ $this->assertEquals($expectedUserProviderId, (string) $arguments[0]);
- $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $providerDefinition->getArgument(2));
- $this->assertEquals('security.user_checker', (string) $providerDefinition->getArgument(2));
+ $this->assertInstanceOf('Symfony\Component\DependencyInjection\Reference', $arguments[1]);
+ $this->assertEquals('security.user_checker', (string) $arguments[1]);
- $this->assertEquals($expectedCreateUserIfNotExists, $providerDefinition->getArgument(3));
+ $this->assertEquals($expectedCreateUserIfNotExists, $arguments[2]);
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.