Skip to content

Commit a2fd951

Browse files
authored
Merge pull request #46 from itk-dev/test/mutation-bundle-extension
test: assert container extension is created and memoized
2 parents 643aa7b + abbf969 commit a2fd951

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1818

1919
### Changed
2020

21+
- Dev: added a test for `ItkDevOpenIdConnectBundle::getContainerExtension()`
22+
asserting the custom extension is created and memoized (same instance on
23+
repeated calls), prompted by mutation testing findings. No effect on the
24+
published package.
2125
- Dev: strengthened DependencyInjection tests based on mutation testing
2226
findings — the extension's container wiring (cache pool reference,
2327
provider options mapping, CLI login route arguments) is now asserted

tests/ItkDevOpenIdConnectBundleTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use ItkDev\OpenIdConnectBundle\Command\UserLoginCommand;
66
use ItkDev\OpenIdConnectBundle\Controller\LoginController;
7+
use ItkDev\OpenIdConnectBundle\DependencyInjection\ItkDevOpenIdConnectExtension;
8+
use ItkDev\OpenIdConnectBundle\ItkDevOpenIdConnectBundle;
79
use ItkDev\OpenIdConnectBundle\Security\CliLoginTokenAuthenticator;
810
use ItkDev\OpenIdConnectBundle\Security\OpenIdConfigurationProviderManager;
911
use ItkDev\OpenIdConnectBundle\Security\OpenIdLoginAuthenticator;
@@ -57,4 +59,18 @@ public function testServiceWiring(): void
5759
$authenticator = $container->get(CliLoginTokenAuthenticator::class);
5860
$this->assertInstanceOf(CliLoginTokenAuthenticator::class, $authenticator);
5961
}
62+
63+
/**
64+
* Test that the custom container extension is created and memoized.
65+
*/
66+
public function testGetContainerExtension(): void
67+
{
68+
$bundle = new ItkDevOpenIdConnectBundle();
69+
70+
$extension = $bundle->getContainerExtension();
71+
$this->assertInstanceOf(ItkDevOpenIdConnectExtension::class, $extension);
72+
73+
// Repeated calls must return the same instance, not recreate it.
74+
$this->assertSame($extension, $bundle->getContainerExtension());
75+
}
6076
}

0 commit comments

Comments
 (0)