@@ -54,6 +54,7 @@ public function testCreateResolverDefinitionOnCreate(): void
5454 $ resolver = new AwsS3ResolverFactory ();
5555
5656 $ resolver ->create ($ container , 'the_resolver_name ' , [
57+ 'client_id ' => null ,
5758 'client_config ' => [],
5859 'bucket ' => 'theBucket ' ,
5960 'acl ' => 'theAcl ' ,
@@ -85,6 +86,7 @@ public function testCreateS3ClientDefinitionOnCreate(): void
8586 $ resolver = new AwsS3ResolverFactory ();
8687
8788 $ resolver ->create ($ container , 'the_resolver_name ' , [
89+ 'client_id ' => null ,
8890 'client_config ' => ['theClientConfigKey ' => 'theClientConfigVal ' ],
8991 'bucket ' => 'aBucket ' ,
9092 'acl ' => 'aAcl ' ,
@@ -108,6 +110,7 @@ public function testCreateS3ClientDefinitionWithFactoryOnCreate(): void
108110 $ resolver = new AwsS3ResolverFactory ();
109111
110112 $ resolver ->create ($ container , 'the_resolver_name ' , [
113+ 'client_id ' => null ,
111114 'client_config ' => ['theClientConfigKey ' => 'theClientConfigVal ' ],
112115 'bucket ' => 'aBucket ' ,
113116 'acl ' => 'aAcl ' ,
@@ -121,13 +124,37 @@ public function testCreateS3ClientDefinitionWithFactoryOnCreate(): void
121124 $ this ->assertSame ([S3Client::class, 'factory ' ], $ clientDefinition ->getFactory ());
122125 }
123126
127+ public function testCreateS3ClientAliasOnCreate (): void
128+ {
129+ $ container = new ContainerBuilder ();
130+
131+ $ resolver = new AwsS3ResolverFactory ();
132+
133+ $ resolver ->create ($ container , 'the_resolver_name ' , [
134+ 'client_id ' => 's3.client.default ' ,
135+ 'client_config ' => [],
136+ 'bucket ' => 'aBucket ' ,
137+ 'acl ' => 'aAcl ' ,
138+ 'get_options ' => [],
139+ 'put_options ' => [],
140+ 'cache ' => false ,
141+ 'proxies ' => [],
142+ ]);
143+
144+ $ this ->assertTrue ($ container ->hasAlias ('liip_imagine.cache.resolver.the_resolver_name.client ' ));
145+
146+ $ clientAlias = $ container ->getAlias ('liip_imagine.cache.resolver.the_resolver_name.client ' );
147+ $ this ->assertSame ('s3.client.default ' , (string ) $ clientAlias );
148+ }
149+
124150 public function testWrapResolverWithProxyOnCreateWithoutCache (): void
125151 {
126152 $ container = new ContainerBuilder ();
127153
128154 $ resolver = new AwsS3ResolverFactory ();
129155
130156 $ resolver ->create ($ container , 'the_resolver_name ' , [
157+ 'client_id ' => null ,
131158 'client_config ' => [],
132159 'bucket ' => 'aBucket ' ,
133160 'acl ' => 'aAcl ' ,
@@ -162,6 +189,7 @@ public function testWrapResolverWithCacheOnCreateWithoutProxy(): void
162189 $ resolver = new AwsS3ResolverFactory ();
163190
164191 $ resolver ->create ($ container , 'the_resolver_name ' , [
192+ 'client_id ' => null ,
165193 'client_config ' => [],
166194 'bucket ' => 'aBucket ' ,
167195 'acl ' => 'aAcl ' ,
@@ -197,6 +225,7 @@ public function testWrapResolverWithProxyAndCacheOnCreate(): void
197225 $ resolver = new AwsS3ResolverFactory ();
198226
199227 $ resolver ->create ($ container , 'the_resolver_name ' , [
228+ 'client_id ' => null ,
200229 'client_config ' => [],
201230 'bucket ' => 'aBucket ' ,
202231 'acl ' => 'aAcl ' ,
@@ -240,6 +269,7 @@ public function testWrapResolverWithProxyMatchReplaceStrategyOnCreate(): void
240269 $ resolver = new AwsS3ResolverFactory ();
241270
242271 $ resolver ->create ($ container , 'the_resolver_name ' , [
272+ 'client_id ' => null ,
243273 'client_config ' => [],
244274 'bucket ' => 'aBucket ' ,
245275 'acl ' => 'aAcl ' ,
@@ -272,6 +302,7 @@ public function testSetCachePrefixIfDefined(): void
272302 $ resolver = new AwsS3ResolverFactory ();
273303
274304 $ resolver ->create ($ container , 'the_resolver_name ' , [
305+ 'client_id ' => null ,
275306 'client_config ' => [],
276307 'bucket ' => 'aBucket ' ,
277308 'acl ' => 'aAcl ' ,
@@ -311,7 +342,7 @@ public function testThrowBucketNotSetOnAddConfiguration(): void
311342 public function testThrowClientConfigNotSetOnAddConfiguration (): void
312343 {
313344 $ this ->expectException (\Symfony \Component \Config \Definition \Exception \InvalidConfigurationException::class);
314- $ this ->expectExceptionMessageMatchesBC ('/^The child (node|config) "client_config" (at path| under) "aws_s3" must be configured\ .$/ ' );
345+ $ this ->expectExceptionMessageMatchesBC ('/^At least "client_id" or "client_config" child config under "aws_s3" must be configured.$/ ' );
315346
316347 $ treeBuilder = new TreeBuilder ('aws_s3 ' );
317348 $ rootNode = method_exists (TreeBuilder::class, 'getRootNode ' )
0 commit comments