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.
[!NOTE]
Replace Mockery with JMac test doubles across core framework tests
- Migrates the entire test suite from Mockery mocks to
JMac\Testing\Double with the VerifiesDoubles PHPUnit trait, converting return values, argument matchers, callbacks, call counts, and exceptions to the new API across cache, database, auth, console, coroutine, AI, filesystem, and foundation tests.
- Some tests now use real objects instead of mocks: created
Request instances, concrete FlattenException and Data objects, a real Hypervel container, and a real Events Dispatcher in DatabaseIntegrationTest.
- Strict Redis client doubles in RedisCacheTestCase.php now fail on unconfigured commands instead of returning Mockery defaults, and many Redis expectations moved from the connection to its client. Fake clients (
FakeRedisClient, PruneRedisClusterClient) record calls for explicit assertions.
- Adds
getHints(): array to ViewFinderInterface.php; custom view finder implementations must now provide getHints(), prependLocation(), and getPaths().
DbCommand::handle now resolves its Symfony Process through the container instead of constructing it directly.
- Behavioral Change: strict doubles and migration changes tighten several tests — e.g. cluster-mode tests in
AddTest/FlushTest no longer fail when pipeline is invoked, testTouchingParent in EloquentBelongsToManyTest.php now expects 09:10:10, and DatabaseDbCommandLaunchTest dropped its separate-process attributes. The VerifiesDoubles trait enforces double verification in every migrated test class.
Macroscope summarized 4d4ad4a.