Skip to content

Modernize tooling: PSR-4, PHPUnit 12, GitHub Actions - #29

Merged
jk merged 5 commits into
developfrom
chore/modernize-tooling
Nov 1, 2026
Merged

jk merged 5 commits into
developfrom
chore/modernize-tooling

Conversation

@jk

@jk jk commented Nov 1, 2026

Copy link
Copy Markdown
Owner

Summary

First step of modernizing the repository: build, test and CI setup. No functional changes to the library code (apart from automated formatting).

  • PHP ^8.3 as minimum (8.2 reaches end of life on 2026-12-31)
  • PSR-4 autoloading – sources moved from src/JK/RestServer/ to src/, tests to tests/
  • PHPUnit 4 + Mockery → PHPUnit 12: attributes instead of annotations, static data providers, expectException*(), current assertion names
  • Travis CI / Scrutinizer / Code Climate / Sami removed, replaced by a GitHub Actions workflow (PHP 8.3, 8.4, 8.5 + lowest dependencies, php-cs-fixer check)
  • PER-CS coding style applied in a separate commit, listed in .git-blame-ignore-revs
  • Dependabot weekly, now also for GitHub Actions; README badges updated

Notable fixes in the test suite

  • The 9 integration tests (group no-travis) were never run in CI. Cause: in production mode, RestServer persists urlMap.cache in its destructor. Unit tests left an empty map behind, so the integration tests routed against it and got 404s. tearDown() now removes the cache; all integration tests run again.
  • URL parameters are passed as strings. Two tests expected integers and only passed because of PHPUnit 4's loose JSON comparison; expectations corrected.

Known remaining issues (next step)

5 PHP deprecations from src/, intentionally not addressed here:

  • self in callables (Utilities.php)
  • ReflectionParameter::getClass() (Utilities.php)
  • dynamic property $obj->server (RestServer.php, becomes an error in PHP 9)

Test plan

  • vendor/bin/phpunit green on PHP 8.3, 8.4, 8.5 (108 tests, 1 skipped – requires Xdebug)
  • green with composer update --prefer-lowest on PHP 8.3
  • php-cs-fixer fix --dry-run clean
  • GitHub Actions workflow green

jkohl added 5 commits November 1, 2026 11:38
- Require PHP ^8.3 (8.2 reaches end of life on 2026-12-31)
- Autoload via PSR-4 (src/, tests/ as autoload-dev) instead of PSR-0
- Replace PHPUnit 4 + Mockery with PHPUnit 12; drop abandoned dev
  dependencies (fabpot/php-cs-fixer, codeclimate/php-test-reporter)
  and redundant PHP_CodeSniffer
- Convert docblock annotations to attributes, use static data providers,
  expectException*() and current assertion names
- Clean up the URL map cache in RestServerTest::tearDown(); a cache
  left behind by unit tests made the integration tests route against an
  empty map, which is why they were excluded from CI ("no-travis")
- URL parameters are strings; fix expectations that only passed because
  of PHPUnit 4's loose JSON comparison
- CI workflow testing PHP 8.3, 8.4 and 8.5 (plus lowest dependencies)
  and checking coding style with php-cs-fixer (PER-CS)
- Remove the discontinued Sami documentation config
- Dependabot: weekly updates, also for GitHub Actions
- README: replace dead badges, drop AMF/Flash mention, add dev section
Automated run of php-cs-fixer, no functional changes.
Code metrics rules (method count, complexity, superglobal access) do not
fit test classes. The former Scrutinizer and Code Climate configs
excluded tests/ as well.
@jk
jk merged commit 1b68b0c into develop Nov 1, 2026
6 of 7 checks passed
@jk
jk deleted the chore/modernize-tooling branch November 1, 2026 16:59
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