Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trejjam authored and f3l1x committed Oct 16, 2023
1 parent 2a15967 commit 9c6dc89
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Cases/GuzzleExtensionTest.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,28 @@ class GuzzleExtensionTest extends TestCase
Assert::count(1, $container->findByType(ClientFactory::class));
}

public function testExtensionDynamic(): void
{
$loader = new ContainerLoader(TEMP_DIR, true);
$class = $loader->load(function (Compiler $compiler): void {
$compiler->setDynamicParameterNames(['guzzle-client']);
$compiler->addConfig([
'parameters'=>[
'guzzle-client' => [],
],
'guzzle' => [
'client' => '%guzzle-client%'
],
]);
$compiler->addExtension('guzzle', new GuzzleExtension());
}, [getmypid(), 1]);

/** @var Container $container */
$container = new $class();

Assert::count(1, $container->findByType(Client::class));
Assert::count(1, $container->findByType(ClientFactory::class));
}
}

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

0 comments on commit 9c6dc89

Please sign in to comment.