Skip to content

Use Double across core framework tests - #111

Merged
binaryfire merged 4 commits into
0.4from
tests-double-remaining-2026-11-17
Nov 16, 2026
Merged

binaryfire merged 4 commits into
0.4from
tests-double-remaining-2026-11-17

Conversation

@binaryfire

@binaryfire binaryfire commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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() to ViewFinderInterface, alongside namespace registration. View caching and static analysis can discover namespaced views through the contract without assuming FileViewFinder. 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() to ViewFinderInterface alongside namespace registration; view caching and static analysis now discover namespaced views without assuming FileViewFinder. 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.

Written for commit 4d4ad4a. Summary will update on new commits.

View guided diff Turn on auto-fix

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.

Replace direct Mockery doubles across AI, API clients, authentication, broadcasting, bus, top-level cache, connection pools and non-scheduler console tests. Keep Mockery-backed framework APIs and existing PHPUnit doubles intact.

Preserve required arguments, object identity, forbidden calls and verification counts with native doubles. Use initialized partials and real containers where appropriate, explicit callback capture, and local operation sequences for cross-double ordering. Declare dynamic Redis and console methods in typed test fixtures without changing production APIs.

Consolidate duplicate Redis lock suites while retaining all distinct acquisition, ownership, callback and cleanup coverage. Verify ApiResource's unknown-method behavior against the real response rather than a mocking-library exception. Strengthen the untouched-parent timestamp assertion and correct the Redis integration comment.

Validation: every changed test class and fixture consumer passed individually, including coroutine, cleanup and cancellation cases. Existing serializer-build skips remain. Root, type-fixture and skeleton static analysis passed; repository and skeleton formatting completed; git diff --check passed.
Replace direct Mockery doubles in the Redis cache suite, remaining scheduler
cases, Context, Cookie, Coordinator, Core, Coroutine, Data and the first
Database test group. Preserve explicit call counts, forbidden calls, argument
checks, cancellation ownership and cross-call ordering.

Exercise Redis operations through initialized connections and strict native
client doubles. Reuse concrete scan fixtures where cursor arguments must be
updated by reference, retaining pagination and concurrent membership-repair
coverage. Record scan inputs and metadata operations for existing assertions;
remove one duplicate page test and an unreachable native null-scan case.

Use real request, DTO and dispatcher objects where mocking adds no value.
Keep scheduler default stubs from absorbing forbidden or excess calls.
Resolve the database CLI Process through the existing container with explicit
parameters, retaining fresh process ownership, launch options and streamed
output while removing constructor interception and isolated test processes.

Validation: every changed test file passed independently. The affected Redis
cache group passed 491 tests with 2803 assertions. Source, type-fixture and
skeleton static analysis passed, as did root/skeleton formatting and the
final changed-file formatting and whitespace checks.
Replace remaining direct Mockery doubles across database lifecycle tests,
DI, Doctor, Encryption, Engine, Filesystem, Fortify and Foundation. Preserve
call counts, argument checks, ordering, exception identity and the existing
framework APIs that still use Mockery internally.

Use real configuration and exception objects where no double is needed.
Exercise Flysystem forwarding through real adapters, keep stream reads in
call resolvers, and record database trait ordering in its existing fixture.
Make the renderer isolation test actually interleave its coroutines, remove
redundant framework cleanup, and delete an unused query-builder test base.

Complete ViewFinderInterface with getHints(), alongside its existing
namespace-registration methods. Remove concrete-finder assumptions from
view caching and analyzer discovery, cover namespaced roots in the command
test, and document the contract requirements for custom implementations.

Tighten tagged-cache flush tests to reject extra native Redis commands and
incorrect keys while preserving the two checks needed for racing writers.

Validation: each changed test file passed, including the existing analyzer
namespace-discovery and cache-invalidation tests. The existing GCS skip is
unchanged. Full static analysis, formatting and whitespace checks passed.
@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Use Double across core framework tests

🧪 Tests ✨ Enhancement 📝 Documentation 🕐 40+ Minutes

Grey Divider

AI Description

• Replace direct Mockery doubles across core and supporting-package tests while preserving
 behavioral assertions.
• Exercise Redis forwarding with strict native-client doubles and consolidate duplicate lock
 coverage.
• Resolve database CLI processes through the container and expose view namespace hints through the
 finder contract.
Diagram

graph TD
  T["Framework tests"] --> D["Double expectations"] --> F["Framework behavior"]
  T --> R["Redis test fixtures"] --> C["Connection forwarding"] --> F
  T --> A["Container process binding"] --> F
  V["View finder contract"] --> F
Loading
High-Level Assessment

Keep the conversion targeted at test doubles rather than replacing Mockery-backed framework APIs. Container resolution avoids constructor interception, and placing namespace hints on the finder contract removes concrete-class assumptions. Concrete scan clients remain appropriate where callback-based doubles cannot preserve cursor references.

Files changed (268) +8552 / -8214

Enhancement (4) +15 / -15
DbCommand.phpResolve CLI process from container +5/-5

Resolve CLI process from container

• Creates the database CLI process through the application with explicit command and environment parameters, allowing tests to replace it while retaining launch configuration and output forwarding.

src/database/src/Console/DbCommand.php

RuntimeInputs.phpRead namespace hints through finder contract +2/-5

Read namespace hints through finder contract

• Includes namespace-hint directories in the view cache key without requiring FileViewFinder.

src/phpstan/src/Support/RuntimeInputs.php

ViewFileHelper.phpDiscover hinted views through finder contract +1/-5

Discover hinted views through finder contract

• Reads namespace hints from any ViewFinderInterface implementation instead of checking its concrete class.

src/phpstan/src/Support/ViewFileHelper.php

ViewFinderInterface.phpExpose namespace hints on view-finder contract +7/-0

Expose namespace hints on view-finder contract

• Adds getHints() so discovery consumers can handle namespaced views through the interface.

src/view/src/ViewFinderInterface.php

Refactor (1) +0 / -2
ViewCacheCommand.phpRemove concrete finder assumption +0/-2

Remove concrete finder assumption

• Removes the FileViewFinder type assertion now that the finder interface supplies the required discovery methods.

src/foundation/src/Console/ViewCacheCommand.php

Tests (261) +8534 / -8197
BroadcastBatchingTest.phpConvert broadcast batching doubles +6/-3

Convert broadcast batching doubles

• Uses Double to verify broadcast batching interactions.

tests/Ai/BroadcastBatchingTest.php

ConcurrentToolsTest.phpConvert concurrent-tool doubles +34/-31

Convert concurrent-tool doubles

• Preserves tool-call expectations while using Double in concurrency coverage.

tests/Ai/ConcurrentToolsTest.php

CoroutineIsolationTest.phpConvert AI coroutine-isolation doubles +25/-22

Convert AI coroutine-isolation doubles

• Uses Double for dependencies in coroutine isolation checks.

tests/Ai/CoroutineIsolationTest.php

AgentEventsTest.phpConvert agent-event doubles +9/-7

Convert agent-event doubles

• Verifies agent event interactions with Double.

tests/Ai/Feature/AgentEventsTest.php

AgentProviderSelectionTest.phpConvert provider-selection doubles +31/-24

Convert provider-selection doubles

• Uses Double to check agent provider selection and associated calls.

tests/Ai/Feature/AgentProviderSelectionTest.php

AiManagerTest.phpConvert AI manager doubles +5/-2

Convert AI manager doubles

• Replaces direct Mockery expectations in manager coverage.

tests/Ai/Feature/AiManagerTest.php

BroadcastAgentTest.phpConvert agent-broadcast doubles +8/-5

Convert agent-broadcast doubles

• Checks agent broadcasting with Double expectations.

tests/Ai/Feature/BroadcastAgentTest.php

EmbeddingsCacheTest.phpConvert embeddings-cache doubles +15/-12

Convert embeddings-cache doubles

• Verifies embeddings cache interactions through Double.

tests/Ai/Feature/EmbeddingsCacheTest.php

FilesystemToolsTest.phpConvert filesystem-tool doubles +27/-23

Convert filesystem-tool doubles

• Uses Double for filesystem tool dependencies and expected calls.

tests/Ai/Feature/FilesystemToolsTest.php

CreatesClientTest.phpConvert gateway client-creation doubles +10/-7

Convert gateway client-creation doubles

• Checks client creation and dependency interactions using Double.

tests/Ai/Feature/Gateway/Concerns/CreatesClientTest.php

PendingProviderTest.phpConvert pending-provider doubles +25/-16

Convert pending-provider doubles

• Preserves pending-provider interaction assertions with Double.

tests/Ai/Feature/PendingProviderTest.php

RememberConversationTest.phpConvert conversation-memory doubles +52/-60

Convert conversation-memory doubles

• Uses Double to verify remembered-conversation storage and retrieval behavior.

tests/Ai/Feature/RememberConversationTest.php

DatabaseConversationStoreTest.phpConvert conversation-store doubles +25/-23

Convert conversation-store doubles

• Checks database conversation-store interactions with Double.

tests/Ai/Feature/Storage/DatabaseConversationStoreTest.php

StoreFakeTest.phpConvert store-fake test dependencies +11/-7

Convert store-fake test dependencies

• Replaces direct Mockery collaborators with Double.

tests/Ai/Feature/StoreFakeTest.php

StreamEventBroadcastTest.phpConvert stream-broadcast doubles +6/-3

Convert stream-broadcast doubles

• Verifies stream-event broadcasts through Double expectations.

tests/Ai/Feature/StreamEventBroadcastTest.php

ToolRequestValidationTest.phpConvert tool-validation doubles +6/-3

Convert tool-validation doubles

• Uses Double in tool request validation coverage.

tests/Ai/Feature/ToolRequestValidationTest.php

ApprovableNamedTool.phpDeclare fixture tool methods +11/-0

Declare fixture tool methods

• Adds typed test-fixture methods needed for verifying dynamic tool interactions with Double.

tests/Ai/Fixtures/Tools/ApprovableNamedTool.php

McpClientTransportTest.phpConvert MCP transport doubles +8/-5

Convert MCP transport doubles

• Checks MCP client transport interactions with Double.

tests/Ai/McpClientTransportTest.php

PartitionStoreTest.phpConvert partition-store doubles +4/-2

Convert partition-store doubles

• Replaces direct Mockery doubles in partition-store coverage.

tests/Ai/PartitionStoreTest.php

InvokesToolsTest.phpConvert tool-invocation doubles +6/-3

Convert tool-invocation doubles

• Uses Double to verify gateway tool invocation.

tests/Ai/Unit/Gateway/InvokesToolsTest.php

AudioFilenameTest.phpSimplify audio-filename test dependency +2/-3

Simplify audio-filename test dependency

• Removes an unnecessary direct Mockery double from audio-filename coverage.

tests/Ai/Unit/Gateway/OpenAi/AudioFilenameTest.php

RunContextTest.phpConvert run-context doubles +6/-3

Convert run-context doubles

• Verifies gateway run-context behavior with Double.

tests/Ai/Unit/Gateway/RunContextTest.php

TextGenerationLoopTest.phpConvert text-generation loop doubles +59/-53

Convert text-generation loop doubles

• Preserves loop call and result assertions with Double expectations.

tests/Ai/Unit/Gateway/TextGenerationLoopTest.php

AgentToolTest.phpConvert agent-tool doubles +18/-15

Convert agent-tool doubles

• Checks agent-tool interactions with Double.

tests/Ai/Unit/Tools/AgentToolTest.php

ApiRequestTest.phpConvert API request doubles +6/-3

Convert API request doubles

• Uses Double for API request collaborators.

tests/ApiClient/ApiRequestTest.php

ApiResourceTest.phpConvert resource doubles and error assertion +36/-39

Convert resource doubles and error assertion

• Uses typed Double collaborators and checks unknown-method behavior against a real response rather than a mocking-library exception.

tests/ApiClient/ApiResourceTest.php

AuthAccessGateTest.phpConvert access-gate doubles +12/-9

Convert access-gate doubles

• Verifies access-gate collaborators with Double.

tests/Auth/AuthAccessGateTest.php

AuthDatabaseTokenRepositoryTest.phpConvert database-token doubles +26/-22

Convert database-token doubles

• Preserves database token repository call assertions with Double.

tests/Auth/AuthDatabaseTokenRepositoryTest.php

AuthEloquentUserProviderCacheTest.phpConvert cached user-provider doubles +162/-167

Convert cached user-provider doubles

• Checks user-provider caching interactions with Double expectations.

tests/Auth/AuthEloquentUserProviderCacheTest.php

AuthManagerTest.phpConvert authentication-manager doubles +92/-93

Convert authentication-manager doubles

• Uses Double to verify manager resolution and guard interactions.

tests/Auth/AuthManagerTest.php

AuthPasswordResetServiceProviderTest.phpConvert password-reset provider doubles +25/-28

Convert password-reset provider doubles

• Checks password-reset service registration with Double.

tests/Auth/AuthPasswordResetServiceProviderTest.php

AuthRequestGuardTest.phpConvert request-guard doubles +20/-17

Convert request-guard doubles

• Uses Double to verify request-guard behavior.

tests/Auth/AuthRequestGuardTest.php

AuthServiceProviderTest.phpConvert auth service-provider doubles +106/-156

Convert auth service-provider doubles

• Preserves authentication service binding and resolution assertions with Double and real objects where suitable.

tests/Auth/AuthServiceProviderTest.php

AuthenticateWithBasicAuthMiddlewareTest.phpConvert basic-auth middleware doubles +19/-15

Convert basic-auth middleware doubles

• Checks middleware guard interactions with Double.

tests/Auth/AuthenticateWithBasicAuthMiddlewareTest.php

AuthorizableTest.phpConvert authorizable doubles +28/-24

Convert authorizable doubles

• Uses Double for authorization interaction assertions.

tests/Auth/AuthorizableTest.php

AuthorizesRequestsTest.phpConvert request-authorization doubles +26/-22

Convert request-authorization doubles

• Verifies request authorization calls with Double.

tests/Auth/AuthorizesRequestsTest.php

CacheTokenRepositoryTest.phpConvert cached-token doubles +57/-53

Convert cached-token doubles

• Checks cache token repository calls and arguments with Double.

tests/Auth/CacheTokenRepositoryTest.php

ClearResetsCommandTest.phpConvert reset-cleanup doubles +16/-13

Convert reset-cleanup doubles

• Verifies reset-clearing command collaborators with Double.

tests/Auth/ClearResetsCommandTest.php

EnsureEmailIsVerifiedTest.phpConvert verification middleware doubles +25/-24

Convert verification middleware doubles

• Checks email-verification middleware behavior using Double.

tests/Auth/EnsureEmailIsVerifiedTest.php

RedirectIfAuthenticatedMiddlewareTest.phpConvert authenticated-redirect doubles +27/-24

Convert authenticated-redirect doubles

• Verifies redirect and guard calls with Double.

tests/Auth/RedirectIfAuthenticatedMiddlewareTest.php

RequirePasswordMiddlewareTest.phpConvert password middleware doubles +56/-58

Convert password middleware doubles

• Checks password-confirmation middleware paths with Double.

tests/Auth/RequirePasswordMiddlewareTest.php

TimeboxIsolationTest.phpConvert timebox-isolation doubles +23/-19

Convert timebox-isolation doubles

• Uses Double for authentication timebox isolation coverage.

tests/Auth/TimeboxIsolationTest.php

UseGuardMiddlewareTest.phpConvert guard-selection doubles +7/-4

Convert guard-selection doubles

• Verifies middleware guard selection through Double.

tests/Auth/UseGuardMiddlewareTest.php

VerifiedEventTest.phpConvert verified-event doubles +5/-2

Convert verified-event doubles

• Replaces direct Mockery event collaborators with Double.

tests/Auth/VerifiedEventTest.php

BroadcastConnectionReleaseTest.phpConvert broadcast-release doubles +19/-14

Convert broadcast-release doubles

• Checks connection release behavior with Double expectations.

tests/Broadcasting/BroadcastConnectionReleaseTest.php

BroadcastPoolProxyTest.phpConvert broadcast-pool doubles +7/-4

Convert broadcast-pool doubles

• Verifies pool proxy forwarding with Double.

tests/Broadcasting/BroadcastPoolProxyTest.php

InteractsWithBroadcastingTest.phpConvert broadcasting-trait doubles +8/-5

Convert broadcasting-trait doubles

• Checks broadcasting trait interactions with Double.

tests/Broadcasting/InteractsWithBroadcastingTest.php

LogBroadcasterTest.phpConvert log-broadcaster doubles +10/-7

Convert log-broadcaster doubles

• Verifies logged broadcast calls with Double.

tests/Broadcasting/LogBroadcasterTest.php

PendingBroadcastTest.phpConvert pending-broadcast doubles +14/-11

Convert pending-broadcast doubles

• Preserves pending-broadcast dispatch expectations with Double.

tests/Broadcasting/PendingBroadcastTest.php

BusDebounceLockTest.phpConvert debounce-lock doubles +16/-12

Convert debounce-lock doubles

• Checks bus debounce lock interactions with Double.

tests/Bus/BusDebounceLockTest.php

DispatchLockContextTest.phpConvert dispatch-lock doubles +19/-16

Convert dispatch-lock doubles

• Verifies dispatch lock context behavior with Double.

tests/Bus/DispatchLockContextTest.php

OutboxOptionsTest.phpConvert outbox-option doubles +7/-3

Convert outbox-option doubles

• Replaces direct Mockery collaborators in outbox options coverage.

tests/Bus/OutboxOptionsTest.php

QueueableTest.phpConvert queueable doubles +11/-7

Convert queueable doubles

• Checks queueable interactions using Double.

tests/Bus/QueueableTest.php

CacheDatabaseLockTest.phpConvert database-lock doubles +124/-120

Convert database-lock doubles

• Preserves lock acquisition, ownership, release, and callback assertions with Double.

tests/Cache/CacheDatabaseLockTest.php

CacheMemoizedStoreTest.phpConvert memoized-store doubles +18/-15

Convert memoized-store doubles

• Checks memoized cache-store interactions with Double.

tests/Cache/CacheMemoizedStoreTest.php

CacheNullStoreTest.phpConvert null-store doubles +7/-4

Convert null-store doubles

• Replaces direct Mockery collaborators with Double.

tests/Cache/CacheNullStoreTest.php

CacheRedisLockTest.phpConsolidate and convert Redis lock tests +222/-81

Consolidate and convert Redis lock tests

• Moves distinct lock acquisition, ownership, callback, failure, and cleanup cases into one Double-based suite.

tests/Cache/CacheRedisLockTest.php

CacheRepositoryEnumTest.phpConvert enum-cache doubles +51/-47

Convert enum-cache doubles

• Checks repository enum caching behavior with Double.

tests/Cache/CacheRepositoryEnumTest.php

CacheServiceProviderTest.phpConvert cache-provider doubles +36/-45

Convert cache-provider doubles

• Verifies cache service-provider registration with Double and suitable real collaborators.

tests/Cache/CacheServiceProviderTest.php

CacheStackStoreLocksTest.phpConvert stack-store lock doubles +28/-21

Convert stack-store lock doubles

• Checks stacked-store lock forwarding with Double.

tests/Cache/CacheStackStoreLocksTest.php

CacheStackStoreTagsTest.phpConvert stack-store tag doubles +193/-166

Convert stack-store tag doubles

• Preserves stacked tagged-cache key and call assertions with Double.

tests/Cache/CacheStackStoreTagsTest.php

CacheStackStoreTest.phpConvert stack-store doubles +364/-276

Convert stack-store doubles

• Uses Double for stacked cache operations, call counts, and failure paths.

tests/Cache/CacheStackStoreTest.php

CacheSwooleStoreConcurrencyTest.phpSimplify Swoole concurrency fixture +2/-3

Simplify Swoole concurrency fixture

• Removes an unnecessary direct Mockery dependency from concurrency coverage.

tests/Cache/CacheSwooleStoreConcurrencyTest.php

CacheSwooleStoreIntervalTest.phpConvert Swoole interval doubles +16/-13

Convert Swoole interval doubles

• Checks interval-driven store behavior with Double.

tests/Cache/CacheSwooleStoreIntervalTest.php

CacheSwooleStoreTest.phpConvert Swoole-store doubles +18/-17

Convert Swoole-store doubles

• Verifies Swoole cache-store collaborators with Double.

tests/Cache/CacheSwooleStoreTest.php

CacheTaggedCacheTest.phpConvert tagged-cache doubles +43/-46

Convert tagged-cache doubles

• Tightens tagged-cache interaction checks while switching to Double.

tests/Cache/CacheTaggedCacheTest.php

ConcurrencyLimiterTest.phpConvert limiter doubles +7/-4

Convert limiter doubles

• Verifies concurrency-limiter interactions through Double.

tests/Cache/ConcurrencyLimiterTest.php

ForgetCommandTest.phpConvert cache-forget doubles +12/-9

Convert cache-forget doubles

• Checks forget-command cache interactions with Double.

tests/Cache/ForgetCommandTest.php

ModelCacheCoordinatorTest.phpConvert model-cache coordinator doubles +111/-107

Convert model-cache coordinator doubles

• Preserves coordinator operation and invalidation expectations with Double.

tests/Cache/ModelCacheCoordinatorTest.php

ModelCacheStoreValidatorTest.phpConvert model-cache validator doubles +19/-16

Convert model-cache validator doubles

• Checks store validation collaborators with Double.

tests/Cache/ModelCacheStoreValidatorTest.php

PruneStaleTagsCommandTest.phpConvert stale-tag pruning doubles +29/-34

Convert stale-tag pruning doubles

• Verifies pruning command calls with Double.

tests/Cache/PruneStaleTagsCommandTest.php

AllTagSetTest.phpConvert all-tag set doubles +30/-40

Convert all-tag set doubles

• Checks all-tag set operations through strict Redis-client expectations.

tests/Cache/Redis/AllTagSetTest.php

AllTaggedCacheTest.phpConvert all-tag cache doubles +306/-342

Convert all-tag cache doubles

• Verifies all-tag cache commands and keys through Redis connection forwarding.

tests/Cache/Redis/AllTaggedCacheTest.php

AnyTagSetTest.phpConvert any-tag set doubles +51/-71

Convert any-tag set doubles

• Checks any-tag set interactions with native-client doubles.

tests/Cache/Redis/AnyTagSetTest.php

AnyTaggedCacheTest.phpConvert any-tag cache doubles +243/-283

Convert any-tag cache doubles

• Verifies any-tag cache command sequences and keys with strict doubles.

tests/Cache/Redis/AnyTaggedCacheTest.php

BenchmarkCommandTest.phpConvert Redis benchmark doubles +42/-36

Convert Redis benchmark doubles

• Checks benchmark command collaborators with Double.

tests/Cache/Redis/Console/BenchmarkCommandTest.php

CleanupVerificationCheckTest.phpConvert cleanup-check doubles +8/-5

Convert cleanup-check doubles

• Verifies Redis cleanup diagnostic calls with Double.

tests/Cache/Redis/Console/Doctor/Checks/CleanupVerificationCheckTest.php

DoctorCommandTest.phpConvert Redis doctor doubles +189/-199

Convert Redis doctor doubles

• Preserves doctor command diagnostics and output assertions with Double.

tests/Cache/Redis/Console/DoctorCommandTest.php

ExceptionPropagationTest.phpConvert Redis exception doubles +33/-24

Convert Redis exception doubles

• Checks propagation of Redis failures through real forwarding and Double expectations.

tests/Cache/Redis/ExceptionPropagationTest.php

AddTest.phpConvert Redis add-operation doubles +11/-16

Convert Redis add-operation doubles

• Checks add commands against strict Redis-client expectations.

tests/Cache/Redis/Operations/AddTest.php

AddEntryTest.phpConvert all-tag add-entry doubles +69/-98

Convert all-tag add-entry doubles

• Verifies add-entry keys and Redis calls using native-client doubles.

tests/Cache/Redis/Operations/AllTag/AddEntryTest.php

AddTest.phpConvert all-tag add doubles +28/-35

Convert all-tag add doubles

• Checks all-tag add command forwarding with Double.

tests/Cache/Redis/Operations/AllTag/AddTest.php

DecrementTest.phpConvert all-tag decrement doubles +41/-57

Convert all-tag decrement doubles

• Verifies decrement commands and tag bookkeeping with Double.

tests/Cache/Redis/Operations/AllTag/DecrementTest.php

FlushStaleTest.phpConvert all-tag stale-flush doubles +48/-63

Convert all-tag stale-flush doubles

• Checks stale-tag flush commands with strict Redis expectations.

tests/Cache/Redis/Operations/AllTag/FlushStaleTest.php

FlushTest.phpConvert all-tag flush doubles +114/-135

Convert all-tag flush doubles

• Verifies all-tag flush command sequences and keys through connection forwarding.

tests/Cache/Redis/Operations/AllTag/FlushTest.php

ForeverTest.phpConvert all-tag forever doubles +59/-79

Convert all-tag forever doubles

• Checks permanent tagged writes against strict Redis expectations.

tests/Cache/Redis/Operations/AllTag/ForeverTest.php

GetEntriesTest.phpConvert all-tag entry-read doubles +97/-170

Convert all-tag entry-read doubles

• Verifies tagged entry reads and associated Redis commands with Double.

tests/Cache/Redis/Operations/AllTag/GetEntriesTest.php

IncrementTest.phpConvert all-tag increment doubles +41/-57

Convert all-tag increment doubles

• Checks increment and tag bookkeeping commands with Double.

tests/Cache/Redis/Operations/AllTag/IncrementTest.php

PruneTest.phpConvert all-tag prune coverage +131/-86

Convert all-tag prune coverage

• Uses strict doubles and concrete scan clients to check pruning commands and cursor behavior.

tests/Cache/Redis/Operations/AllTag/PruneTest.php

PutManyTest.phpConvert all-tag bulk-write doubles +121/-163

Convert all-tag bulk-write doubles

• Verifies bulk tagged writes and Redis command arguments with Double.

tests/Cache/Redis/Operations/AllTag/PutManyTest.php

PutTest.phpConvert all-tag put doubles +73/-96

Convert all-tag put doubles

• Checks tagged write commands and keys through connection forwarding.

tests/Cache/Redis/Operations/AllTag/PutTest.php

TouchTest.phpConvert all-tag touch doubles +13/-16

Convert all-tag touch doubles

• Verifies tagged entry touch commands using Double.

tests/Cache/Redis/Operations/AllTag/TouchTest.php

AddTest.phpConvert any-tag add doubles +36/-44

Convert any-tag add doubles

• Checks any-tag add command arguments through native-client doubles.

tests/Cache/Redis/Operations/AnyTag/AddTest.php

DecrementTest.phpConvert any-tag decrement doubles +37/-37

Convert any-tag decrement doubles

• Verifies decrement and tag updates with Double.

tests/Cache/Redis/Operations/AnyTag/DecrementTest.php

FlushTest.phpConvert any-tag flush doubles +129/-96

Convert any-tag flush doubles

• Checks flush commands and tag keys with strict client expectations.

tests/Cache/Redis/Operations/AnyTag/FlushTest.php

ForeverTest.phpConvert any-tag forever doubles +5/-5

Convert any-tag forever doubles

• Checks permanent any-tag writes with Double.

tests/Cache/Redis/Operations/AnyTag/ForeverTest.php

GetTagItemsTest.phpConvert any-tag item-read doubles +24/-36

Convert any-tag item-read doubles

• Verifies tag-item lookup commands through connection forwarding.

tests/Cache/Redis/Operations/AnyTag/GetTagItemsTest.php

GetTaggedKeysTest.phpConvert tagged-key lookup doubles +23/-35

Convert tagged-key lookup doubles

• Checks any-tag key lookup commands with Double.

tests/Cache/Redis/Operations/AnyTag/GetTaggedKeysTest.php

IncrementTest.phpConvert any-tag increment doubles +37/-37

Convert any-tag increment doubles

• Verifies increment and tag bookkeeping with Double.

tests/Cache/Redis/Operations/AnyTag/IncrementTest.php

PruneTest.phpStrengthen any-tag pruning coverage +229/-153

Strengthen any-tag pruning coverage

• Uses concrete scan clients to preserve cursor references and asserts Redis keys, script calls, and command counts.

tests/Cache/Redis/Operations/AnyTag/PruneTest.php

PutManyTest.phpConvert any-tag bulk-write doubles +40/-43

Convert any-tag bulk-write doubles

• Checks bulk tagged writes through strict client doubles.

tests/Cache/Redis/Operations/AnyTag/PutManyTest.php

PutTest.phpConvert any-tag put doubles +37/-41

Convert any-tag put doubles

• Verifies tagged write commands and arguments with Double.

tests/Cache/Redis/Operations/AnyTag/PutTest.php

DecrementTest.phpConvert Redis decrement doubles +3/-3

Convert Redis decrement doubles

• Checks decrement command forwarding with Double.

tests/Cache/Redis/Operations/DecrementTest.php

FlushTest.phpConvert Redis flush doubles +8/-8

Convert Redis flush doubles

• Verifies flush command forwarding with Double.

tests/Cache/Redis/Operations/FlushTest.php

ForeverTest.phpConvert Redis forever doubles +4/-6

Convert Redis forever doubles

• Checks permanent cache-write commands with Double.

tests/Cache/Redis/Operations/ForeverTest.php

ForgetTest.phpConvert Redis forget doubles +2/-2

Convert Redis forget doubles

• Verifies forget command forwarding with Double.

tests/Cache/Redis/Operations/ForgetTest.php

GetTest.phpConvert Redis get doubles +8/-8

Convert Redis get doubles

• Checks read command forwarding with Double.

tests/Cache/Redis/Operations/GetTest.php

IncrementTest.phpConvert Redis increment doubles +4/-4

Convert Redis increment doubles

• Verifies increment command forwarding with Double.

tests/Cache/Redis/Operations/IncrementTest.php

ManyTest.phpConvert Redis many-read doubles +4/-6

Convert Redis many-read doubles

• Checks multi-key read forwarding with Double.

tests/Cache/Redis/Operations/ManyTest.php

PutManyTest.phpConvert Redis bulk-write doubles +17/-19

Convert Redis bulk-write doubles

• Verifies multi-key write commands with Double.

tests/Cache/Redis/Operations/PutManyTest.php

PutTest.phpConvert Redis put doubles +8/-12

Convert Redis put doubles

• Checks write commands and arguments with Double.

tests/Cache/Redis/Operations/PutTest.php

RedisCacheTestCase.phpExercise real Redis connection forwarding +51/-192

Exercise real Redis connection forwarding

• Replaces Mockery connection scaffolding with passthrough connection doubles and strict native Redis or RedisCluster client doubles. Unexpected commands now fail rather than silently succeeding.

tests/Cache/Redis/RedisCacheTestCase.php

RedisStoreTest.phpConvert Redis-store doubles +48/-54

Convert Redis-store doubles

• Checks Redis store operations against Double expectations and real connection forwarding.

tests/Cache/Redis/RedisStoreTest.php

SerializationTest.phpConvert Redis serialization doubles +28/-29

Convert Redis serialization doubles

• Verifies serialization behavior with native-client doubles.

tests/Cache/Redis/Support/SerializationTest.php

StoreContextTest.phpConvert Redis store-context doubles +37/-30

Convert Redis store-context doubles

• Checks store-context connection and client interactions with Double.

tests/Cache/Redis/Support/StoreContextTest.php

RegisterSwooleMaintenanceTimersTest.phpConvert maintenance-timer doubles +44/-35

Convert maintenance-timer doubles

• Verifies Swoole maintenance timer registration with Double.

tests/Cache/RegisterSwooleMaintenanceTimersTest.php

ConnectionPoolTest.phpConvert connection-pool doubles +27/-26

Convert connection-pool doubles

• Checks pool acquisition and release interactions with Double.

tests/ConnectionPool/ConnectionPoolTest.php

ConnectionTest.phpConvert pooled-connection doubles +146/-151

Convert pooled-connection doubles

• Preserves connection lifecycle and forwarding expectations with Double.

tests/ConnectionPool/ConnectionTest.php

FooPool.phpAdapt pool fixture for Double +2/-2

Adapt pool fixture for Double

• Adjusts the test pool fixture to support converted pool tests.

tests/ConnectionPool/Fixtures/FooPool.php

IdleConnectionMonitorTest.phpConvert idle-monitor doubles +51/-29

Convert idle-monitor doubles

• Verifies idle-connection monitoring and cleanup calls with Double.

tests/ConnectionPool/IdleConnectionMonitorTest.php

KeepaliveConnectionTest.phpConvert keepalive doubles +24/-24

Convert keepalive doubles

• Checks keepalive connection interactions with Double.

tests/ConnectionPool/KeepaliveConnectionTest.php

InteractsWithIOTest.phpConvert console I/O doubles +12/-10

Convert console I/O doubles

• Verifies I/O trait calls and arguments with Double.

tests/Console/Concerns/InteractsWithIOTest.php

ConfiguresPromptsTest.phpConvert prompt-configuration doubles +43/-38

Convert prompt-configuration doubles

• Checks prompt configuration and callbacks with Double.

tests/Console/ConfiguresPromptsTest.php

ConsoleApplicationDeferredCallbacksTest.phpConvert deferred-callback doubles +7/-4

Convert deferred-callback doubles

• Verifies console deferred callbacks with Double.

tests/Console/ConsoleApplicationDeferredCallbacksTest.php

EventsTest.phpConvert console-event doubles +13/-10

Convert console-event doubles

• Checks console event interactions using Double.

tests/Console/Events/EventsTest.php

FooExceptionCommand.phpAdapt exception-command fixture +4/-4

Adapt exception-command fixture

• Adjusts the command fixture for Double-based console tests.

tests/Console/Fixtures/Commands/FooExceptionCommand.php

FooExitCommand.phpAdapt exit-command fixture +4/-4

Adapt exit-command fixture

• Adjusts the command fixture for Double-based console tests.

tests/Console/Fixtures/Commands/FooExitCommand.php

ComponentsFactory.phpDeclare dynamic console component methods +42/-0

Declare dynamic console component methods

• Adds a typed fixture exposing dynamically dispatched prompt and output methods to Double verification.

tests/Console/Fixtures/ComponentsFactory.php

GeneratorCommandTest.phpConvert generator-command doubles +36/-33

Convert generator-command doubles

• Verifies generated paths and command interactions with Double.

tests/Console/GeneratorCommandTest.php

InteractsWithSignalsTest.phpConvert signal-handling doubles +17/-13

Convert signal-handling doubles

• Checks console signal callbacks with Double.

tests/Console/InteractsWithSignalsTest.php

MigrationGeneratorCommandTest.phpConvert migration-generator doubles +6/-3

Convert migration-generator doubles

• Verifies generator collaborators with Double.

tests/Console/MigrationGeneratorCommandTest.php

CallbackEventTest.phpConvert scheduled-callback doubles +10/-7

Convert scheduled-callback doubles

• Checks callback-event execution with Double.

tests/Console/Scheduling/CallbackEventTest.php

ScheduleRunCommandTest.phpConvert schedule-run doubles +201/-206

Convert schedule-run doubles

• Preserves scheduling, output, and execution expectations with Double.

tests/Console/Scheduling/ScheduleRunCommandTest.php

ScheduleRunContextPropagationTest.phpConvert scheduler context doubles +21/-19

Convert scheduler context doubles

• Verifies context propagation into scheduled work with Double.

tests/Console/Scheduling/ScheduleRunContextPropagationTest.php

ComponentsTest.phpConvert console-component doubles +8/-6

Convert console-component doubles

• Checks console component calls with Double and typed fixture methods.

tests/Console/View/ComponentsTest.php

ContextCoroutineTest.phpSimplify coroutine-context dependency

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can choose which labels appear on a finding, and whether they show icons or text

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 4/5 Tier: plus

[Medium impact] Most effects stay in framework tests, while view-finder changes reach custom finders and view discovery.

The older-phpredis test failure still needs fixing before merge.

Fix All in Claude CodeFindings

  1. P1 Older Redis clients break tests ▶

Summary

Replaces direct Mockery doubles with Double across core framework tests.

  • Framework tests use JMac Testing doubles to check their collaborators.
  • The database command creates its client process through the application container.
  • View finders expose namespace hints so tools can discover namespaced views.

No new findings were accepted from the latest changes. Tests were not run; this review used source inspection.

Reviews (2) · Last reviewed commit: "Preserve cache tests against unexpected ..." · Reviewed by Greptile


return $connection;
// Unexpected commands must fail: an extra Redis round trip is a regression.
$client = Double::for(Redis::class)->strict();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Older Redis clients break tests

These native doubles make the affected unit tests require phpredis 6.3, although composer.json supports ^6.1. On 6.1/6.2, the native classes lack hsetex, so expectations in DoctorCommandTest and AnyTag/PutManyTest cannot target a declared method. Previously these commands were mocked on RedisConnection.

Declare the newer commands in a test fixture, or skip only the affected cases on older clients. The RedisCluster helper needs the same treatment.

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This finding is valid. A separate follow-up PR will raise the framework-wide PhpRedis minimum to 6.3 and remove the obsolete older-client checks. This PR intentionally leaves that requirement change to the follow-up; CI already uses PhpRedis 6.3. We will not add fake native methods or skip these cases.

Comment on lines +184 to +185
$this->swoole->expects('get')->with('foo')->returns(null);
$this->redis->expects('get')->with('foo')->returns(['expiration' => 123]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Malformed writes escape the test

testMalformedLowerRecordRemainsAMiss() no longer catches writes of the malformed record. Both stores are now lenient doubles, while the only assertion checks the returned null. An unwanted put() or forever() call can pass unnoticed; the previous Mockery stores rejected it.

Make these doubles strict or explicitly forbid writes so the test still catches malformed records being copied into the upper cache.

Fix in Claude Code Fix in Codex

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed: stack cache layers and tagged cache doubles are strict, restoring protection against unexpected writes and deletions. Existing explicit negative assertions and compensation tests remain. The affected tests pass.

Make the disabled-pruning query builder and stack cache layer doubles strict so unconfigured reads, writes and deletions fail as they did before the Double conversion. Apply the same protection to tagged cache layers while retaining explicit negative assertions and real-store compensation coverage.

All three affected test files pass. Full formatting and the final targeted formatting check pass. No production behavior or dependency requirements change.
@binaryfire
binaryfire merged commit 9ba7c9f into 0.4 Nov 16, 2026
45 checks passed
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