@@ -80,6 +80,16 @@ public function testExtension(): void
8080 'subscribe ' => 'https://example.com/book/1.jsonld ' ,
8181 ],
8282 ],
83+ 'managed2 ' => [
84+ 'url ' => 'https://demo.mercure.rocks/managed ' ,
85+ 'jwt ' => [
86+ 'secret ' => '!ChangeMe! ' ,
87+ 'algorithm ' => 'rsa.sha512 ' ,
88+ 'passphrase ' => 'test ' ,
89+ 'publish ' => ['* ' ],
90+ 'subscribe ' => 'https://example.com/book/1.jsonld ' ,
91+ ],
92+ ],
8393 ],
8494 ],
8595 ];
@@ -110,6 +120,31 @@ public function testExtension(): void
110120 $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenProviderInterface $managedTokenProvider ' , $ container ->getAliases ());
111121 $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenFactoryInterface $managedTokenFactory ' , $ container ->getAliases ());
112122
123+ $ this ->assertTrue ($ container ->hasDefinition ('mercure.hub.managed2 ' )); // Hub instance
124+ $ this ->assertTrue ($ container ->hasDefinition ('mercure.hub.managed2.publisher ' )); // Publisher
125+ $ this ->assertTrue ($ container ->hasDefinition ('mercure.hub.managed2.jwt.provider ' ));
126+ $ this ->assertTrue ($ container ->hasDefinition ('mercure.hub.managed2.jwt.factory ' ));
127+ $ this ->assertArrayHasKey ('mercure.publisher ' , $ container ->getDefinition ('mercure.hub.managed2.publisher ' )->getTags ());
128+ $ this ->assertSame ($ config ['mercure ' ]['hubs ' ]['managed2 ' ]['url ' ], $ container ->getDefinition ('mercure.hub.managed2 ' )->getArgument (0 ));
129+ $ this ->assertSame ($ config ['mercure ' ]['hubs ' ]['managed2 ' ]['jwt ' ]['secret ' ], $ container ->getDefinition ('mercure.hub.managed2.jwt.factory ' )->getArgument (0 ));
130+ $ this ->assertSame ($ config ['mercure ' ]['hubs ' ]['managed2 ' ]['jwt ' ]['algorithm ' ], $ container ->getDefinition ('mercure.hub.managed2.jwt.factory ' )->getArgument (1 ));
131+ $ this ->assertSame ($ config ['mercure ' ]['hubs ' ]['managed2 ' ]['jwt ' ]['passphrase ' ], $ container ->getDefinition ('mercure.hub.managed2.jwt.factory ' )->getArgument (3 ));
132+ $ this ->assertSame ([$ config ['mercure ' ]['hubs ' ]['managed2 ' ]['jwt ' ]['subscribe ' ]], $ container ->getDefinition ('mercure.hub.managed2.jwt.provider ' )->getArgument (1 ));
133+ $ this ->assertSame ($ config ['mercure ' ]['hubs ' ]['managed2 ' ]['jwt ' ]['publish ' ], $ container ->getDefinition ('mercure.hub.managed2.jwt.provider ' )->getArgument (2 ));
134+
135+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\HubInterface $managed2 ' , $ container ->getAliases ());
136+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\PublisherInterface $managed2 ' , $ container ->getAliases ());
137+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenProviderInterface $managed2 ' , $ container ->getAliases ());
138+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenFactoryInterface $managed2 ' , $ container ->getAliases ());
139+
140+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\HubInterface $managed2Hub ' , $ container ->getAliases ());
141+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\PublisherInterface $managed2Publisher ' , $ container ->getAliases ());
142+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenProviderInterface $managed2Provider ' , $ container ->getAliases ());
143+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenFactoryInterface $managed2Factory ' , $ container ->getAliases ());
144+
145+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenProviderInterface $managed2TokenProvider ' , $ container ->getAliases ());
146+ $ this ->assertArrayHasKey ('Symfony\Component\Mercure\Jwt\TokenFactoryInterface $managed2TokenFactory ' , $ container ->getAliases ());
147+
113148 $ this ->assertTrue ($ container ->hasDefinition ('mercure.hub.demo ' )); // Hub instance
114149 $ this ->assertTrue ($ container ->hasDefinition ('mercure.hub.demo.publisher ' )); // Publisher
115150 $ this ->assertTrue ($ container ->hasDefinition ('mercure.hub.demo.jwt.provider ' ));
0 commit comments