@@ -48,6 +48,48 @@ public function testLoad(): void
4848 $ this ->assertTrue ($ container ->hasDefinition (CliLoginTokenAuthenticator::class));
4949 }
5050
51+ public function testLoadWiresProviderManagerConfig (): void
52+ {
53+ $ extension = new ItkDevOpenIdConnectExtension ();
54+ $ container = new ContainerBuilder ();
55+
56+ $ extension ->load ([$ this ->getBaseConfig ()], $ container );
57+
58+ $ config = $ container ->getDefinition (OpenIdConfigurationProviderManager::class)->getArgument ('$config ' );
59+ $ this ->assertIsArray ($ config );
60+
61+ $ defaultOptions = $ config ['default_providers_options ' ] ?? null ;
62+ $ this ->assertIsArray ($ defaultOptions );
63+ $ cacheItemPool = $ defaultOptions ['cacheItemPool ' ] ?? null ;
64+ $ this ->assertInstanceOf (Reference::class, $ cacheItemPool );
65+ $ this ->assertSame ('cache.app ' , (string ) $ cacheItemPool );
66+
67+ // Provider options must be keyed by provider name with the
68+ // intermediate 'options' level stripped.
69+ $ providers = $ config ['providers ' ] ?? null ;
70+ $ this ->assertIsArray ($ providers );
71+ $ this ->assertSame (['test_provider ' ], array_keys ($ providers ));
72+ $ provider = $ providers ['test_provider ' ];
73+ $ this ->assertIsArray ($ provider );
74+ $ this ->assertArrayNotHasKey ('options ' , $ provider );
75+ $ this ->assertSame ('test_id ' , $ provider ['client_id ' ]);
76+ }
77+
78+ public function testLoadWiresCacheAndCliLoginRoute (): void
79+ {
80+ $ extension = new ItkDevOpenIdConnectExtension ();
81+ $ container = new ContainerBuilder ();
82+
83+ $ extension ->load ([$ this ->getBaseConfig ()], $ container );
84+
85+ $ cache = $ container ->getDefinition (CliLoginHelper::class)->getArgument ('$cache ' );
86+ $ this ->assertInstanceOf (Reference::class, $ cache );
87+ $ this ->assertSame ('cache.app ' , (string ) $ cache );
88+
89+ $ this ->assertSame ('test_route ' , $ container ->getDefinition (UserLoginCommand::class)->getArgument ('$cliLoginRoute ' ));
90+ $ this ->assertSame ('test_route ' , $ container ->getDefinition (CliLoginTokenAuthenticator::class)->getArgument ('$cliLoginRoute ' ));
91+ }
92+
5193 public function testLoadWithUserProvider (): void
5294 {
5395 $ extension = new ItkDevOpenIdConnectExtension ();
0 commit comments