Restore strict expectations in tests converted to Double
Double accepts unexpected calls by default and compares object arguments by value. Some tests lost checks when they moved from Mockery. They could pass if a handler received a different instance or if code called an unexpected method.
The tests now use strict doubles unless they deliberately ignore unrelated calls. They check object identity where the same request, job, connection or exception must be passed through. Tests that record arguments do so after a call matches. The suite uses Double's development branch for its fixes to expectation verification.
Several tests now check the result directly. For example, the permission scope tests exercise both integer and UUID keys, and the Reverb test checks that a subscribed socket actually receives the broadcast.
There’s also a fix for idle database connections. If releasing one lease throws, the resolver now attempts to release the remaining leases before propagating the failure. Cancellation takes precedence if cleanup encounters both cancellation and another error.
Summary by cubic
Restores the strictness lost when tests moved from Mockery to Double, so unexpected calls and object substitutions can no longer pass silently.
- Double is lenient by default and compares object arguments by value; ported tests now use
strict()doubles andArgument::same()where instance identity matters. - Argument recording and assertions moved out of Double matcher predicates, which Double can evaluate more than once.
- The suite pins
jasonmccreary/doubletodev-masterfor fixes to expectation verification. ConnectionResolver::releaseIdleConnections()releases every idle lease before propagating the first failure, with cancellation taking precedence.- Permission scope tests now exercise integer and UUID fixture keys, and the Reverb test verifies the subscribed socket receives the broadcast.
- Fixture updates model real behavior: Redis release tests use a connected client in atomic mode, the Guzzle body-export test verifies the caller keeps its open resource after a failed read, Sentry telemetry covers the deferred WebSocket handshake and optional OTLP lookup, and the Tinker caster test permits unrelated application reads while requiring the failing property and version lookup.
[!NOTE]
Restore strict expectations in tests converted to Double
- Converts most test doubles across the suite to strict mode, so unconfigured calls fail the test. Uses
Argument::same for identity matching of objects, Argument::capture plus post-call assertions instead of side-effecting matcher callbacks, and expectNotToPerformAssertions() instead of trivial assertTrue(true) placeholders.
- Updates AGENTS.md testing guidance: prefer strict doubles unless a test intentionally ignores unrelated calls; notes that
with() compares objects with == and recommends Argument::same() for exact-instance matching.
- Changes
jasonmccreary/double constraint in composer.json from ^1.1.1 to dev-master.
- Fixes idle-connection cleanup in ConnectionResolver.php: a throwing
releaseIfIdle call no longer aborts the loop; remaining idle values are still released, then the preferred failure (cancellation preferred via Coroutine::preferCancellation) is thrown.
- Behavioral Change: strict doubles reject any call not explicitly configured, so previously silently ignored interactions (e.g.
Process::stop on destructor, isMaria) now require allowances; the ConnectionResolver cleanup fix changes failure propagation when multiple idle releases throw.
Macroscope summarized 3dab76a.