2
2
3
3
namespace Cspray \AnnotatedContainer \Secrets \Test ;
4
4
5
+ use Cspray \AnnotatedContainer \Secrets \ArrayValueProvider ;
5
6
use Cspray \AnnotatedContainer \Secrets \Exception \InvalidParameterStoreIdentifier ;
6
7
use Cspray \AnnotatedContainer \Secrets \Exception \NoSourcesProvided ;
7
8
use Cspray \AnnotatedContainer \Secrets \SecretsParameterStore ;
8
9
use Cspray \AnnotatedContainer \Secrets \SecretsParameterStoreFactory ;
10
+ use Cspray \AnnotatedContainer \Secrets \SingleValueProviderSource ;
9
11
use Cspray \AnnotatedContainer \Secrets \Source ;
10
12
use PHPUnit \Framework \Attributes \CoversClass ;
11
13
use PHPUnit \Framework \TestCase ;
14
+ use function Cspray \Typiphy \stringType ;
12
15
13
16
#[
14
17
CoversClass(SecretsParameterStoreFactory::class),
15
18
CoversClass(SecretsParameterStore::class),
16
19
CoversClass(InvalidParameterStoreIdentifier::class),
17
- CoversClass(NoSourcesProvided::class)
20
+ CoversClass(NoSourcesProvided::class),
21
+ CoversClass(ArrayValueProvider::class),
22
+ CoversClass(SingleValueProviderSource::class),
18
23
]
19
24
final class SecretsParameterStoreFactoryTest extends TestCase {
20
25
@@ -46,4 +51,14 @@ public function testFactoryConstructorGivenNoSourcesThrowsException() : void {
46
51
new SecretsParameterStoreFactory ([]);
47
52
}
48
53
49
- }
54
+ public function testSourcesAreProvidedToSecretsParameterStore () : void {
55
+ $ subject = new SecretsParameterStoreFactory (
56
+ [new SingleValueProviderSource ('source ' , new ArrayValueProvider (['foo ' => 'bar ' ]))]
57
+ );
58
+
59
+ $ store = $ subject ->createParameterStore (SecretsParameterStore::class);
60
+
61
+ self ::assertSame ('bar ' , $ store ->fetch (stringType (), 'source.foo ' ));
62
+ }
63
+
64
+ }
0 commit comments