test: assert discovery document and JWKS caching behavior#51
Merged
Conversation
Mutation testing showed the cache write path was executed but never verified: the set/expiresAfter/save calls for both the discovery document and the JWKS key map could be removed without a failing test (silently disabling caching entirely), the namespaced cache key was unasserted, and a multi-key JWKS could be truncated to its first entry unnoticed. Kills 8 escaped mutants. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e-behavior # Conflicts: # CHANGELOG.md
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #51 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 71 71
===========================================
Files 1 1
Lines 185 185
===========================================
Hits 185 185
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Second of three scoped follow-ups to #49. Targets the caching cluster: 8 escaped mutants showing the entire cache write path could be deleted — disabling discovery/JWKS caching — without a failing test.
Features Added
testGetConfigurationCachesFetchedDocument: on a cache miss, the fetched discovery document is stored (set), given the configured TTL (expiresAfter(3600)), and saved — under the exact namespaced cache key (itk-openid-connect-configuration-||<sha1>||configuration)testGetJwtVerificationKeysCachesFetchedKeys: same contract for the built JWKSKeymaptestGetJwtVerificationKeysBuildsAllJwksKeys: a JWKS with two keys must reachJWT::decodein full — the token'skidmay match any key published by the IdP, so truncating the map to one entry is a real bugFiles Changed
tests/Security/OpenIdConfigurationProviderTest.php- three new testsCHANGELOG.md- Unreleased bulletTest Plan
vendor/bin/phpunit— 100 tests, 182 assertions, greenvendor/bin/infection— kills its 8 targeted mutants (57 → 49 escapes on this branch alone; combines with test: assert full exception messages, codes and previous-chains #50 to 16 remaining)🤖 Generated with Claude Code