From a147524589fe1620a2cd4b7e920ab19dd343210c Mon Sep 17 00:00:00 2001 From: turegjorup Date: Thu, 11 Jun 2026 10:05:12 +0200 Subject: [PATCH] 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 --- CHANGELOG.md | 5 +++++ tests/ItkDevOpenIdConnectBundleTest.php | 16 ++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e51abb7..ad3c2f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- Dev: added a test for `ItkDevOpenIdConnectBundle::getContainerExtension()` + asserting the custom extension is created and memoized (same instance on + repeated calls), prompted by mutation testing findings. No effect on the + published package. + - CI: bumped `codecov/codecov-action` from `v5` to `v7` (restores Codecov's GPG signing key after the `codecovsecurity` account was removed, and moves the bundled `github-script` to Node 24) and set `fail_ci_if_error: false` diff --git a/tests/ItkDevOpenIdConnectBundleTest.php b/tests/ItkDevOpenIdConnectBundleTest.php index 6948230..1593cd3 100644 --- a/tests/ItkDevOpenIdConnectBundleTest.php +++ b/tests/ItkDevOpenIdConnectBundleTest.php @@ -4,6 +4,8 @@ use ItkDev\OpenIdConnectBundle\Command\UserLoginCommand; use ItkDev\OpenIdConnectBundle\Controller\LoginController; +use ItkDev\OpenIdConnectBundle\DependencyInjection\ItkDevOpenIdConnectExtension; +use ItkDev\OpenIdConnectBundle\ItkDevOpenIdConnectBundle; use ItkDev\OpenIdConnectBundle\Security\CliLoginTokenAuthenticator; use ItkDev\OpenIdConnectBundle\Security\OpenIdConfigurationProviderManager; use ItkDev\OpenIdConnectBundle\Security\OpenIdLoginAuthenticator; @@ -57,4 +59,18 @@ public function testServiceWiring(): void $authenticator = $container->get(CliLoginTokenAuthenticator::class); $this->assertInstanceOf(CliLoginTokenAuthenticator::class, $authenticator); } + + /** + * Test that the custom container extension is created and memoized. + */ + public function testGetContainerExtension(): void + { + $bundle = new ItkDevOpenIdConnectBundle(); + + $extension = $bundle->getContainerExtension(); + $this->assertInstanceOf(ItkDevOpenIdConnectExtension::class, $extension); + + // Repeated calls must return the same instance, not recreate it. + $this->assertSame($extension, $bundle->getContainerExtension()); + } }