From a9417457b7bfc462a37b4b78245f2875a7ee46e2 Mon Sep 17 00:00:00 2001 From: "Israel J. Carberry" Date: Wed, 27 Oct 2021 13:00:50 -0500 Subject: [PATCH] Add missing authenticator dependency injection argument --- DependencyInjection/Security/Factory/OAuthFactory.php | 1 + .../Security/Factory/OAuthFactoryTest.php | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Security/Factory/OAuthFactory.php b/DependencyInjection/Security/Factory/OAuthFactory.php index 54af33cb..90ed48de 100644 --- a/DependencyInjection/Security/Factory/OAuthFactory.php +++ b/DependencyInjection/Security/Factory/OAuthFactory.php @@ -38,6 +38,7 @@ public function createAuthenticator(ContainerBuilder $container, string $id, arr ->replaceArgument(0, new Reference('fos_oauth_server.server')) ->replaceArgument(1, new Reference('security.token_storage')) ->replaceArgument(2, new Reference('security.user_checker.'.$id)) + ->replaceArgument(3, new Reference($userProviderId)) ; return $providerId; diff --git a/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php b/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php index ce4b7e96..3965693f 100644 --- a/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php +++ b/Tests/DependencyInjection/Security/Factory/OAuthFactoryTest.php @@ -124,6 +124,7 @@ public function testCreateAuthenticator(): void ; $id = '12'; $config = []; + $userProviderId = 'mock.user.provider.service'; $definition = $this->getMockBuilder(Definition::class) ->disableOriginalConstructor() @@ -141,7 +142,7 @@ public function testCreateAuthenticator(): void ; $definition - ->expects($this->exactly(3)) + ->expects($this->exactly(4)) ->method('replaceArgument') ->withConsecutive( [ @@ -155,9 +156,14 @@ public function testCreateAuthenticator(): void [ 2, new Reference('security.user_checker.'.$id), + ], + [ + 3, + new Reference($userProviderId), ] ) ->willReturnOnConsecutiveCalls( + $definition, $definition, $definition, $definition @@ -166,7 +172,7 @@ public function testCreateAuthenticator(): void $this->assertSame( 'fos_oauth_server.security.authentication.authenticator.'.$id, - $this->instance->createAuthenticator($container, $id, $config, 'ignored.user.provider.service') + $this->instance->createAuthenticator($container, $id, $config, $userProviderId) ); }