Use Double across core framework tests
Test doubles
Replace direct Mockery doubles with Double across AI, authentication, cache, console, coroutine, Data, database, filesystem, Fortify and Foundation tests, including their supporting packages. Keep existing PHPUnit doubles and framework APIs backed by Mockery.
The conversion preserves required calls, arguments, ordering, forbidden calls and exception behavior. Tests use real objects where mocking adds no value. Redis cache tests exercise real connection forwarding with strict native-client doubles, and scan tests use concrete clients to preserve cursor updates by reference. Duplicate Redis lock coverage is consolidated and an unused query-builder test base is removed.
Supporting changes
- Resolve the database CLI process through the container with explicit constructor parameters. Tests can replace it without constructor interception or separate PHP processes; launch options and output forwarding stay intact.
- Add
getHints()toViewFinderInterface, alongside namespace registration. View caching and static analysis can discover namespaced views through the contract without assumingFileViewFinder. Document the requirements for custom finders. - Make the exception-renderer isolation test interleave coroutines and tighten tagged-cache tests to reject extra Redis commands or incorrect keys.
Verification
Changed test files and affected fixture consumers pass individually, including Redis cache coverage and analyzer view-discovery/cache-invalidation tests. Existing dependency and serializer-build skips remain unchanged. Full static analysis, root and skeleton formatting, and whitespace checks pass.
Summary by cubic
Replaces direct Mockery doubles with Double across AI, authentication, cache, console, coroutine, Data, database, filesystem, Fortify, and Foundation tests, including their supporting packages. PHPUnit doubles and framework APIs backed by Mockery remain unchanged.
- Resolves the database CLI process through the container with explicit constructor parameters so tests can replace it without constructor interception or separate PHP processes.
- Adds
getHints()toViewFinderInterfacealongside namespace registration; view caching and static analysis now discover namespaced views without assumingFileViewFinder. Custom finders must implement the new method. - Interleaves coroutines in the exception-renderer isolation test; makes disabled-pruning query builder and cache stack or tagged layer doubles strict so unconfigured reads, writes, and deletions fail as they did before the conversion, while retaining explicit negative assertions and real-store compensation coverage.
- Consolidates duplicate Redis lock coverage, removes an unused query-builder test base, and uses real objects where mocking adds no value.
Supporting changes
- Redis cache tests exercise real connection forwarding with strict native-client doubles; scan tests use concrete clients to preserve cursor updates by reference.
[!NOTE]
Migrate core framework tests from Mockery to JMac test doubles
- Replaces Mockery mocks with JMac Testing doubles across the Auth, Cache, Database, Console, Foundation, Bus, Filesystem, Ai, and other core test suites. Each class adds the PHPUnit
VerifiesDoubles trait and converts return, throw, call-count, callback, and never-called expectations to the new expects/allows/returns/resolves API.
- Redis command expectations move from connection wrappers to the underlying client doubles, with new fixtures like FakeRedisClient.php and
PruneRedisClusterClient recording calls for explicit assertions.
- Adds
getHints(): array to ViewFinderInterface.php and removes FileViewFinder instanceof guards in the phpstan view helpers; updates view docs and the porting guide accordingly.
- DbCommand.php now resolves
Process through the container instead of constructing it directly.
- Behavioral Change:
ViewFinderInterface implementers must now provide getHints(); several tests now assert exact Redis return values (e.g. false instead of null for failed SET NX, true instead of 1 for expire) and recorded call orderings instead of Mockery global ordering.
Macroscope summarized 4d4ad4a.