Skip to content

test: assert discovery document and JWKS caching behavior#51

Merged
turegjorup merged 2 commits into
developfrom
test/mutation-cache-behavior
Jun 11, 2026
Merged

test: assert discovery document and JWKS caching behavior#51
turegjorup merged 2 commits into
developfrom
test/mutation-cache-behavior

Conversation

@turegjorup

Copy link
Copy Markdown
Collaborator

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 JWKS Key map
  • testGetJwtVerificationKeysBuildsAllJwksKeys: a JWKS with two keys must reach JWT::decode in full — the token's kid may match any key published by the IdP, so truncating the map to one entry is a real bug

Files Changed

  • tests/Security/OpenIdConfigurationProviderTest.php - three new tests
  • CHANGELOG.md - Unreleased bullet

Test Plan

🤖 Generated with Claude Code

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>
@turegjorup turegjorup merged commit 6438d0a into develop Jun 11, 2026
15 checks passed
@turegjorup turegjorup deleted the test/mutation-cache-behavior branch June 11, 2026 09:15
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (d5ebdd0) to head (f43ab39).
⚠️ Report is 3 commits behind head on develop.

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           
Flag Coverage Δ
unittests 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant