Skip to content

Commit 9c6dc89

Browse files
trejjamf3l1x
authored andcommitted
Add tests
1 parent 2a15967 commit 9c6dc89

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

tests/Cases/GuzzleExtensionTest.phpt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,28 @@ class GuzzleExtensionTest extends TestCase
5757
Assert::count(1, $container->findByType(ClientFactory::class));
5858
}
5959

60+
public function testExtensionDynamic(): void
61+
{
62+
$loader = new ContainerLoader(TEMP_DIR, true);
63+
$class = $loader->load(function (Compiler $compiler): void {
64+
$compiler->setDynamicParameterNames(['guzzle-client']);
65+
$compiler->addConfig([
66+
'parameters'=>[
67+
'guzzle-client' => [],
68+
],
69+
'guzzle' => [
70+
'client' => '%guzzle-client%'
71+
],
72+
]);
73+
$compiler->addExtension('guzzle', new GuzzleExtension());
74+
}, [getmypid(), 1]);
75+
76+
/** @var Container $container */
77+
$container = new $class();
78+
79+
Assert::count(1, $container->findByType(Client::class));
80+
Assert::count(1, $container->findByType(ClientFactory::class));
81+
}
6082
}
6183

6284
(new GuzzleExtensionTest())->run();

0 commit comments

Comments
 (0)