Skip to content

Port server tests to PHPUnit 12 mock API#115

Merged
ericmann merged 2 commits into
mainfrom
fix/phpunit-12-server-tests
Apr 18, 2026
Merged

Port server tests to PHPUnit 12 mock API#115
ericmann merged 2 commits into
mainfrom
fix/phpunit-12-server-tests

Conversation

@ericmann

Copy link
Copy Markdown
Contributor

Summary

  • PHPUnit 12 removed MockBuilder::addMethods(), which the server suite used heavily to mock Predis\Client commands (dispatched via __call(), so invisible to reflection).
  • Add tests/Support/RedisClientStub.php — a subclass of Predis\Client exposing the mocked commands as concrete no-ops so onlyMethods() can override them.
  • Swap all 13 test files to mock the stub and use onlyMethods().
  • Convert CreateRequestTest @dataProvider docblocks to #[DataProvider] attributes (annotation metadata removed in PHPUnit 12).
  • Bundles the dependabot bump from Bump phpunit/phpunit from 11.5.55 to 12.5.22 in /server #113 so Keel can pick up a fresh image.

Closes #113.

Test plan

  • composer install resolves PHPUnit 12.5.22
  • vendor/bin/phpunit — 189 tests, 0 errors, 0 failures (local run in php:8.4-cli)
  • CI test job passes on this PR

dependabot Bot and others added 2 commits April 18, 2026 14:53
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 11.5.55 to 12.5.22.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/12.5.22/ChangeLog-12.5.md)
- [Commits](sebastianbergmann/phpunit@11.5.55...12.5.22)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-version: 12.5.22
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
PHPUnit 12 removed MockBuilder::addMethods(); Predis\Client dispatches
commands via __call() so reflection can't see them for onlyMethods().
Add a test-only stub class exposing the commands we mock as concrete
no-ops, then mock the stub with onlyMethods() throughout the suite.
Also convert CreateRequestTest @dataProvider annotations to the
#[DataProvider] attribute.
@ericmann ericmann merged commit 13bd3a9 into main Apr 18, 2026
6 checks passed
@ericmann ericmann deleted the fix/phpunit-12-server-tests branch April 18, 2026 22:16
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