Skip to content

Commit a147524

Browse files
turegjorupclaude
andcommitted
test: assert container extension is created and memoized
Mutation testing showed all five mutants of the getContainerExtension() condition survived: the extension type was never asserted and repeated calls recreating the extension went unnoticed. One test asserting the concrete type and instance identity on a second call kills all five. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent c826902 commit a147524

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

CHANGELOG.md

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

1010
### Changed
1111

12+
- Dev: added a test for `ItkDevOpenIdConnectBundle::getContainerExtension()`
13+
asserting the custom extension is created and memoized (same instance on
14+
repeated calls), prompted by mutation testing findings. No effect on the
15+
published package.
16+
1217
- CI: bumped `codecov/codecov-action` from `v5` to `v7` (restores Codecov's
1318
GPG signing key after the `codecovsecurity` account was removed, and moves
1419
the bundled `github-script` to Node 24) and set `fail_ci_if_error: false`

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)