Skip to content

Add 100% test coverage, fix JWKS cache bug, and modernize CI#34

Merged
turegjorup merged 19 commits into
developfrom
feature/test-coverage
Mar 20, 2026
Merged

Add 100% test coverage, fix JWKS cache bug, and modernize CI#34
turegjorup merged 19 commits into
developfrom
feature/test-coverage

Conversation

@turegjorup
Copy link
Copy Markdown
Collaborator

@turegjorup turegjorup commented Mar 9, 2026

Ticket

6996

Summary

  • Achieve 100% test coverage (up from 72.85% lines / 58.33% methods)
  • Fix JWKS verification keys cache bug (missing save() call)
  • Fix PHP 8.4 implicit nullable parameter deprecations
  • Upgrade to PHPUnit 12 with all necessary API changes
  • Modernize CI: migrate from shivammathur/setup-php to Docker Compose
  • Add PHP 8.4 and 8.5 test matrices using Docker Compose extends
  • Restructure workflows to match openid-connect-bundle pattern (Changelog, Composer, PHP)
  • Add Taskfile for local development tasks (task setup, task test, task test:matrix, task pr:actions)
  • Update README with revised development setup documentation and test matrix instructions
  • Normalize composer.json with ergebnis/composer-normalize
  • Lint YAML and Markdown files
  • Replace phpcs.xml.dist with PHP-CS-Fixer configuration via Taskfile

Test plan

  • All 43 tests pass across PHP 8.3, 8.4, and 8.5
  • 100% code coverage verified via Codecov
  • PHPCS coding standards pass
  • PHPStan static analysis passes
  • Composer validate and audit pass
  • CI green on all workflows

🤖 Generated with Claude Code

- Add 24 new tests covering all untested methods and error paths
- Fix JWKS verification keys not being saved to cache (missing save() call)
- Document JWT::$leeway static property limitation for multi-tenant setups
- Document exp claim validation delegation to firebase/php-jwt
- Add userinfo_endpoint to mock OpenID configuration

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turegjorup turegjorup requested a review from jekuaitk March 9, 2026 12:17
@turegjorup turegjorup self-assigned this Mar 9, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 9, 2026

Codecov Report

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

Additional details and impacted files
@@               Coverage Diff               @@
##             develop       #34       +/-   ##
===============================================
+ Coverage      74.41%   100.00%   +25.58%     
  Complexity        62        62               
===============================================
  Files              1         1               
  Lines            172       172               
===============================================
+ Hits             128       172       +44     
+ Misses            44         0       -44     
Flag Coverage Δ
Unit ?
unittests 100.00% <100.00%> (?)

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

☔ View full report in Codecov by Sentry.
📢 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.

- Fix anonymous class brace style to comply with PSR-12
- Add unreleased changelog entries for test coverage and cache fix

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@jekuaitk jekuaitk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!


$item->set($keys);
$item->expiresAfter($this->cacheDuration);
$this->cacheItemPool->save($item);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀 🚀

@jekuaitk jekuaitk self-requested a review March 9, 2026 12:42
- Replace monolithic pr.yaml (shivammathur/setup-php) with separate
  workflow files using docker compose, following the itk-dev devops template
- Add phpfpm84 and phpfpm85 services using compose extends
- Run unit tests across PHP 8.3, 8.4, and 8.5
- Fix implicit nullable parameters deprecated in PHP 8.4
- Update actions/checkout to v5

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turegjorup turegjorup changed the title Add 100% test coverage and fix JWKS cache bug Add 100% test coverage, fix JWKS cache bug, and modernize CI Mar 9, 2026
turegjorup and others added 8 commits March 9, 2026 13:51
Add `user: ${COMPOSE_USER:-deploy}` to phpfpm service, matching the
itk-dev devops template pattern. CI sets COMPOSE_USER=runner so
composer can write to the volume-mounted workspace.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Consolidate separate phpcs, phpstan, and phpunit workflows into a single
php.yaml workflow. Update composer.yaml with prefer matrix and inline
user flag. Remove COMPOSE_USER env var in favor of --user flag.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turegjorup turegjorup requested a review from jekuaitk March 10, 2026 09:36
Copy link
Copy Markdown
Collaborator

@jekuaitk jekuaitk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Two comments/statements but approved.

$glue = parse_url($url, PHP_URL_QUERY) === null ? '?' : '&';
$url .= $glue . $this->buildQueryString($params);
$glue = null === parse_url($url, PHP_URL_QUERY) ? '?' : '&';
$url .= $glue.$this->buildQueryString($params);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be a new rule. I've always been bugged by our coding standards to keep these spaces 👀

Comment thread README.md
```shell
docker compose exec phpfpm composer install
docker compose exec phpfpm ./vendor/bin/phpunit
task pr:actions
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Comment thread Taskfile.yml
cmds:
- "{{.PHP}} vendor/bin/php-cs-fixer fix"

lint:composer:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Im not sure i would classify all the steps in this task as linting but i suppose it works.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed

turegjorup and others added 7 commits March 16, 2026 13:54
Use per-combination Docker services (PHP version × dependency set) with
isolated named volumes to prevent vendor cross-contamination between
matrix runs. Align test:matrix pattern with openid-connect-bundle.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace php.yaml (had duplicate composer content) with proper PHP
  workflow including coding-standards, phpstan, and unit-tests jobs
- Update service names to match docker-compose.yml (phpfpm84-stable,
  phpfpm85-stable instead of phpfpm84, phpfpm85)
- Add docker network create frontend steps to all jobs
- Remove pr.yaml (content moved to php.yaml)
- Remove unnecessary matrix from composer-validate job
- Fix Taskfile.yml prettier formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Restore php.yaml with correct service names for CI matrix. Simplify
docker-compose base service to match itkdev template 3.2.1 and add
simple phpfpm84/phpfpm85 services. Matrix services now extend their
version-specific parent instead of repeating image overrides.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add user, networks, and extra_hosts to phpfpm base service to fix CI
permission errors (composer.lock write denied). Matches the pattern
from openid-connect-bundle PR #27.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add composer:check task (validate, normalize, audit). Rename analyze to
analyze:php for clarity. Add composer:check to pr:actions. Simplify
test:matrix formatting.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Correct inconsistent 2-space indentation in composer:check and
test:matrix tasks to match the 4-space convention used throughout.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turegjorup turegjorup requested a review from jekuaitk March 18, 2026 11:54
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turegjorup turegjorup merged commit fd39f37 into develop Mar 20, 2026
16 checks passed
@turegjorup turegjorup deleted the feature/test-coverage branch March 20, 2026 09:04
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.

2 participants