Repository navigation
Complete the framework test conversion to Double - #112
Conversation
Native Redis and RedisCluster doubles exercise hash-expiry methods declared by PhpRedis 6.3. Align the components development requirement with those tests and the existing CI image, without changing any published package requirement or runtime compatibility checks. Composer resolution and manifest validation pass. The Redis doctor and AnyTag put-many tests pass with the declared development dependency.
Record the complete metadata, diagnostics, compatibility cleanup, tests and documentation needed for a future runtime minimum bump. Preserve optional Redis installation, explain the Composer conflict tradeoff, and distinguish obsolete client gates from necessary server, build and topology checks. Self-reviewed against the current call sites and package metadata. The plan is deferred and requires authorization before implementation; only the development minimum has changed.
Move the single-consumer MultiExec methods onto RedisProxy beside the scan methods and delete the trait. Preserve the transaction and pipeline implementations while declaring their native return unions. Remove the analyzer's obsolete trait-declaring-class exception. Include null in RedisConnection::client() after close or failed connection setup. Keep the shared native-client test access separate from production getConnection()/client() semantics and update its existing consumers. Validated Redis proxy and multi-exec coverage, affected Redis connection/cache tests, cancellation analyzer tests, facade regeneration and facade docblocks. Full source/type/skeleton analysis and formatting pass.
Replace direct Mockery doubles with typed Double expectations across client connections, routing, server calls, exception mapping and response creation. Retain call counts, argument constraints, cancellation expectations and response assertions, using strict doubles where unexpected calls must fail. Each changed test file passes. Source analysis and formatting pass.
Use a real container and configuration repository for hashing setup, with Double reserved for the custom driver. Exercise the Hasher contract's real make() API when checking facade forwarding instead of an invented mock method. Convert the head schema logger expectation while retaining warning context and call-count checks. All changed test files pass; formatting and source analysis pass.
Replace direct Mockery test doubles with Double while retaining framework-provided mock APIs. Share real Redis proxy, pool and connection forwarding around strict native clients, and preserve production client()/getConnection() behavior. Exercise the real withConnection lease path for locks and metrics, use configuration-driven cluster selection, and freeze time for exact native eval arguments. Keep process destructor allowances separate from explicit operation expectations, and retain lifecycle, payload and listener assertions. Every changed unit and integration test file passes, including the Redis-backed Horizon integration tests. Source/type/skeleton analysis and formatting pass.
Replace direct Mockery test doubles with typed Double expectations for HTTP clients, request helpers, streaming responses and Swoole bridges. Preserve argument constraints and negative expectations; execute response-stat callbacks through resolvers rather than matcher side effects. Make the Swoole response helper allow only explicitly requested incidental successful methods. Keep those defaults disjoint from required header and emission expectations, including the sendfile headers. Each changed test file passes, with the existing Swoole-dependent skip retained. Source analysis and formatting pass.
Replace direct Mockery doubles with Double while retaining framework-backed mocking APIs and real child-process fixtures. Keep image pipeline argument checks and cache behavior assertions. Use a fulfilled promise for resolved response data, and remove the unused BladeCompiler/filesystem setup from the directive test so it exercises the configured application compiler directly. All changed test files pass; the existing image environment skip remains. Source analysis and formatting pass.
Replace direct Mockery doubles throughout JWT parsing, guards, events, manager setup and cache storage. Preserve the cancellation, context, payload and subject-lock assertions and all required calls. Use an override control wrapper for the container's reserved instance method, establish default leeway before test-specific configuration, and use concrete tagged-cache return types for the optional tags capability. Every changed JWT test file passes. Full source/type/skeleton analysis and formatting pass.
Use Double for loggers, event dispatchers, queue jobs and the native server in the logging test suite. Preserve context isolation, queue propagation and logging argument assertions. Remove unused dispatcher defaults and execute intentional event side effects through resolvers, keeping the required dispatch expectations explicit. All changed logging test files pass. Full source/type/skeleton analysis and formatting pass.
Replace direct Mockery doubles in attachment, transport, rendering and queued-mail tests. Preserve required calls and forbidden MIME detection, and keep real QueueFake behavior for queue-routing assertions. Use a real view factory and engine resolver beneath the Markdown rendering doubles so render-local clones retain their initialized finder state. All nine changed test files passed individually. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Keep registrar and command expectations strict, and use real OutputStyle behavior around the mocked question response. Preserve process cancellation and cleanup ordering, with a separate allowance for the destructor's one-argument stop call. All four changed test files passed individually, including the real subprocess transport cases. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Replace resolver, connection, grammar and query-builder mocks with doubles of their native types. Preserve optional metadata stubs and the assertion that structural identity does not open a database connection. NestedSetTest passed all 20 tests and 46 assertions. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Replace direct dispatcher, mail factory and Markdown mocks while retaining the real notification rendering and coroutine-isolation behavior. Existing framework-backed test helpers remain unchanged. Both changed test files passed individually. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Preserve strict lifecycle, reporting, cancellation and cleanup expectations. Express conditional required or forbidden reporting with exact counts, and inject the native instances from application override controls. Keep real pools and lifecycle fixtures for stateful behavior. All seven changed test files passed individually. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Replace direct Mockery dependencies throughout deferred signals, instrumentation, providers, logging and export scheduling. Preserve required calls, forbidden work, callback registration and concurrent lifecycle checks. Keep the manager container strict while checking identity registration through recorded calls. Consolidate repeated identical export expectations into one counted callback, and remove an unused cache-test parameter and artificial assertion counts. Every changed test file passed individually; the corrected manager tests pass 15 tests and 94 assertions. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Use strict doubles for console kernel and runtime inputs, and application override controls for configuration source discovery. Preserve optional provider-discovery stubs and the real analyzer fixtures. Both changed files passed with phpunit.phpstan.xml.dist: 16 tests and 41 assertions combined. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Replace the remaining direct view-factory mocks while keeping real resolver rebinding and coroutine-local pagination checks. No pagination source or public API changes. PaginationResolverTest passed 18 tests and 42 assertions. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Preserve native WebAuthn types, real action behavior around protected validation doubles, and controller failure responses. Keep event spies intentionally lenient while asserting exact listener checks and forbidden dispatches after execution, without overlapping default stubs. All seven changed test files passed individually; real ceremony fixtures and existing PHPUnit doubles remain. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Replace the remaining direct mocks across client authentication, replay protection, token issuance, guards, signing keys and response rendering. Preserve memoization counts, negative lookups, token invalidation failures and callback-driven concurrency checks. Use real Eloquent forwarding over a native query-builder double. Keep cache coordinator passthru behavior with disjoint failing-key stubs and real invalidation delegates. Consolidate identical key-generation and resource-validation expectations into counted sequences. Every changed test file passed individually, including all three PostgreSQL signing-key concurrency tests on an isolated database. Validation for the complete conversion slice: composer lint:fix, composer analyse and git diff --check passed.
Document why the Stdio transport test permits stop(0.0): Symfony calls it when the process double is released. This preserves the existing destructor cleanup without obscuring explicit stop expectations. Validation: StdioTransportTest passed (14 tests, 43 assertions).
Replace directly created Mockery doubles with native Double targets and automatic verification. Preserve the cache lookup, callback and stored-value assertions. Every changed test file was run during conversion; fixture changes were verified through their consumers. Full formatting and static analysis passed at the slice checkpoint.
Convert direct doubles for permission events, guards, cache integration and partition queue context. Keep Mockery-backed facade APIs intact and separate default event-listener stubs from constrained expectations. Every changed test file was run during conversion; fixture changes were verified through their consumers. Full formatting and static analysis passed at the slice checkpoint.
Use Double for directly created pipeline dependencies while retaining the existing execution, exception and container behavior coverage. Required calls remain expectations and optional setup remains explicit stubbing. Every changed test file was run during conversion; fixture changes were verified through their consumers. Full formatting and static analysis passed at the slice checkpoint.
Use initialized native process doubles and preserve stop arguments, call counts, output guards and cancellation cleanup. A local destructor-free process fixture keeps implicit Symfony destructor cleanup from consuming expectations for explicit stop calls; these fixtures never start child processes. Validation: ProcessTest passed (124 tests, 343 assertions, one existing skip); formatting and analysis passed.
Replace the direct Mockery animation dependency with a verified Double target. Keep the existing isolated process and coroutine execution behavior. Validation: PromptAnimationTest passed; formatting and analysis passed.
Preserve transaction callbacks, publication outcomes, retries, cancellation and cleanup with typed Double expectations. Replace SQS magic-method mocks with a real SDK client using its in-memory MockHandler, and exercise Redis publication through native connection forwarding. Retain explicit post-call checks where configurable cache defaults must coexist with call-count assertions. Use native Pheanstalk interfaces and real initialized queue fixtures instead of phantom methods. Every changed test file was run during conversion; fixture changes were verified through their consumers. Full formatting and static analysis passed at the slice checkpoint.
Preserve queue identifiers, typed worker options, retry payloads and failed-record handling with strict native doubles. Capture retry payloads directly and exercise SQS retry commands through the real SDK with an isolated handler, checking FIFO metadata and consumed responses. Every changed test file was run during conversion; fixture changes were verified through their consumers. Full formatting and static analysis passed at the slice checkpoint.
Convert remaining queue dispatch, pooling, driver, job and middleware doubles in this slice. Preserve required calls, forbidden calls and callback ordering; use queued-command fixtures with InteractsWithQueue for middleware and native queue jobs for worker paths. Exercise CallQueuedHandler failure injection directly instead of a placeholder assertion. Reuse NullQueue behavior in the pool fixture, retain real Pheanstalk job data, and use the SQS SDK handler for lifecycle failures and response consumption. Every changed test file was run during conversion; fixture changes were verified through their consumers. Full formatting and static analysis passed at the slice checkpoint. WorkerTimeoutTest passed all 11 cases using the converted subprocess fixture.
Convert directly created doubles in queue middleware, reservation, resource-lifetime and outbox claim coverage. Retain framework-backed Mockery spies and preserve real SQLite/Redis behavior and cancellation assertions. Use command fixtures for middleware and an explicit publishing queue fixture for pooled outbox lifetime checks. No service discovery or production behavior changes. Every changed test file was run during conversion; fixture changes were verified through their consumers. Full formatting and static analysis passed at the slice checkpoint. SQLite and isolated Redis consumers passed; existing engine-specific skips remain unchanged.
Reuse the existing typed console component fixture for task and two-column output rather than introducing duplicate helpers. Convert command and action mocks to strict doubles, retaining filesystem failures, pretend behavior, server lifecycle cleanup, and exact prompt responses. Validation: every changed test file and Console ConfiguresPromptsTest passed. The package-mode Testbench suite passed with 679 tests, 2068 assertions, and three skips. Full static analysis and formatting passed.
Preserve migration ownership, rollback ordering, bootstrap failures, and process-envelope coverage with strict doubles. Use existing application objects where no mock behavior is needed, keep environment cleanup exception-safe, and document Symfony's destructor stop allowance. Validation: each changed test file passed, as did composer test:testbench (679 tests, 2068 assertions, three skips), full static analysis, and formatting.
Convert database constraint and rendered-view dependencies to strict doubles without changing their behavioral assertions. Replace only the Telescope dependency doubles in the global cleanup tests; retain Mockery-specific verification and cleanup coverage. Validation: all three changed test files passed. Full static analysis and formatting passed.
Preserve application casting failure isolation, view exception forwarding, request-scoped shared data, and static cleanup coverage. Use the real engine resolver and strict doubles for collaborators, with proxy override mode for the application's instance method collision. Validation: every changed test file passed. Full static analysis and formatting passed.
Retain batch query counts, fallback memoization, typed identity matching, compiled execution, and field substitution assertions with strict doubles. Replace assertion side effects in a matcher with a pure predicate, and use real container and translator objects for factory state tests. Validation: all four files passed, including 214 compiled-execution tests with 806 assertions. Full static analysis and formatting passed.
Pass falsey field values and additional arguments through the Can rule unchanged. Restrict policy dispatch to strings and objects so ordinary gate callbacks accept numeric, boolean, and array context without type errors. Cache policy discovery only for real classes after resolution, retaining cached negative results and enum classes while preventing request-derived strings from growing worker memory. Preserve explicit mappings and custom guessers. Restore upstream's repeated non-class guesser test and use real classes for cache assertions. Validation: AuthAccessGateTest passed (148 tests, 309 assertions); ValidationRuleCanTest passed (8 tests, 37 assertions). Regression cases were confirmed against the old behavior. Full static analysis and formatting passed.
Add a default Doctor diagnostic that fails production checks when Composer's class map is not authoritative, with the release-build command and worker restart remediation. Skip the check in local mode; leave loader state and development behavior unchanged. Document the production deployment check, porting requirement, and generated-proxy loader compatibility. Authoritative maps avoid filesystem misses and Composer's worker-lifetime cache of missing names without framework-owned loader workarounds. Validation: the real Doctor command passes its local, failing-production, and passing-production cases (3 tests, 10 assertions). Provider registration tests passed (48 tests, 210 assertions). Full static analysis, formatting, and whitespace checks passed.
Move the contract completeness guidance into Code conventions using the approved wording. Require documented behavior shared by all implementations to be declared on the contract, including omissions inherited from Laravel, while keeping optional capabilities on separate interfaces. Remove the narrower PHPStan-only copy and renumber that checklist. Preserve the existing approval requirement for Laravel API changes.
Replace direct Mockery doubles with Double while retaining strict calls and meaningful negative expectations. Use a real container for lookup-only setup and record cross-object shutdown order explicitly. Validation: all affected Watcher and Wayfinder test classes passed; full static analysis and formatting passed.
Keep handshake, message and close failure coverage with typed doubles and explicit lifecycle expectations. Use real container wiring for bootstrap and preserve caller-owned dispatcher expectations in helpers. Validation: every affected WebSocket test class passed, including cancellation and cleanup cases; full static analysis and formatting passed.
Replace direct Mockery dependencies while preserving PostgreSQL conversation concurrency and auth cache invalidation coverage. Match cache repositories by identity and check that invalidation has not occurred before transaction commit. Validation: PostgreSQL conversation storage/concurrency cases and the auth cache suite passed; full static analysis and formatting passed.
Extract the existing typed Redis proxy fixture for unit and integration consumers. Use initialized Double partials for queue fakes and broadcast managers, and real requests, routers and cache repositories where their behavior matters. Validation: Redis broadcaster, broadcast manager and anonymous broadcast tests passed; full static analysis and formatting passed.
Declare shared typed getters, bulk operations, missing and flush on the repository contract so interface consumers can call the public cache API. Keep optional capabilities separate. Route native flush through clear so ordinary flushes emit success/failure events and preserve cancellation handling. Update memoized flush coverage, remove an obsolete analyzer suppression and regenerate the Cache facade. Convert the remaining cache integration doubles using the completed contract. Validation: regression cases failed before the event fix and passed afterward. The Cache suite, memoized integration cases and seven Redis integration files passed; full analysis, formatting and facade checks passed.
Use Double for direct console integration dependencies, keeping initialized queue fakes and explicit connection selection. Preserve environment encryption/decryption and scheduling behavior assertions. Validation: every affected console and concurrency test file passed; full static analysis and formatting passed.
Replace Mockery in Eloquent query-count and pooled connection tests. Preserve initialized database pool behavior, protected connection creation stubs and shared SQLite PDO lifecycle assertions. Validation: affected Eloquent, pooled connection, SQLite heartbeat and shared-PDO tests passed; full static analysis and formatting passed.
Use initialized filesystem partials for installer failure cases, with targeted throwing stubs and exact exception assertions. Retain real filesystem behavior for other paths without fallback doubles. Convert command and authentication dependencies while preserving cleanup and framework-backed mocking APIs. Validation: each changed foundation test class passed, including installer read/publication failures; full static analysis and formatting passed.
Convert filesystem, generator, routing, session, support and view dependencies. Keep framework facade expectations where required and use a passthru compiler with a received-call assertion to verify view-path deduplication while compiling real templates. Validation: all affected files passed, including SQLite sessions and task-owned Redis sessions; full static analysis and formatting passed.
Replace benchmark-only Mockery clients with typed Pusher and Ably doubles and a real Mercure token provider. Keep the existing controlled delivery delay and pool behavior without depending on Mockery cleanup. Validation: syntax and command help passed; one operation each for Pusher, Ably and Mercure completed locally without external HTTP calls. No benchmark measurements were changed.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
PR Summary by QodoComplete framework test conversion to Double
AI Description
Diagram
High-Level Assessment
Files changed (519)
|
Code Review by Qodo
1. Cluster pipelines can fail with a type error
|
[High impact] The PR appears safe to merge; no new actionable issue remains. SummaryCompletes the remaining direct Mockery-to-Double conversions and adds framework corrections.
binaryfire intentionally chose explicit policy mappings for unusual PHP model aliases that depend on alias-specific container settings. Review checks found no new actionable issue. Reviews (3) · Last reviewed commit: "Preserve configured policy names for dec..." · Reviewed by Greptile |
The components checkout needs a newer native Redis client for test doubles than published packages require. Check that its ext-redis range is contained within the split requirement instead of demanding equality for this one dependency. Keep exact equality for every other dependency and record removal with the deferred framework-wide bump. Validation: reproduced the CI manifest failure, then passed the complete manifest checks. Full analysis and formatting pass.
Reindex the arguments collected by Rule::can before appending the validated value. Named variadic arguments otherwise reach Gate before a positional value and raise an unpacking error. Preserve falsey authorization data. Validation: the named-factory regression fails before this correction and passes afterward. Validation Can, Data attribute and affected Gate consumer tests pass; full analysis and formatting pass.
Admit only declared model class names to the policy cache, leaving original argument spelling available to discovery hooks. Resolve guessed policy classes by their declared name so case and leading-backslash variants cannot bypass canonical bindings or grow separate container instances. Normal canonical cache hits do no additional work. Validation: regressions fail before the correction and pass afterward. Auth, query-aware policies on PostgreSQL, Foundation authorization, Permission, Telescope and policy consistency consumers pass; full analysis and formatting pass.
Choose the autoload optimization flag from the current Composer loader when regenerating files. Keep the displayed repair command consistent with execution, so repairing validity does not silently disable authoritative class lookup. Leave development-package selection and the read-only validity probe unchanged. Validation: both loader modes and relocated vendor coverage pass after reproducing the regression. The Doctor suite, full analysis and formatting pass.
|
Qodo review dispositions:
|
Classify model input once on a policy-cache miss. Preserve guessed policy names for declared classes so container aliases, bindings, extenders and contextual dependencies retain their configured behavior. Normalize guesses only for other inputs to prevent request spellings from growing worker state. Keep cache admission tied to declared names and explain the deliberate tradeoff for unusual PHP alias inputs beside the decision. Explicit policy mappings remain the direct path for those configurations. No container introspection or extra cache representation is needed. Validation: the alias-extender regression fails before the change and passes afterward. Auth and Can-rule tests, Foundation authorization, Permission, Telescope, policy-consistency consumers and PostgreSQL policy queries pass. Full static analysis and formatting pass.
Complete the Double conversion
Convert the remaining directly created Mockery mocks and spies to Double across the framework tests and pooled-connection benchmark fixtures. Keep Mockery where it backs framework testing APIs, including facade expectations, container mocking helpers, console expectations and authentication helpers.
Use real objects where mocking adds no value, preserve initialized behavior for partial doubles, and make meaningful call counts, negative expectations and ordering explicit. Redis tests use real forwarding and native-client fixtures, including the existing scan fixtures that preserve cursor updates. Remove redundant tests while retaining their distinct coverage.
Framework corrections
Canvalidation rule and allow gates to receive ordinary data. Cache policy discovery for declared model names and preserve their configured policy resolution. Normalize guesses from other inputs so arbitrary spellings cannot grow worker memory. Explicit policy mappings remain available for unusual PHP aliases requiring their own container configuration.flush()emit the same lifecycle events asclear(), including failure events, and preserve cancellation handling.RedisProxy, add native return types, and correctRedisConnection::client()to include null after close. Remove the analyzer special case made unnecessary by the move.Validation
Run the affected test files throughout the conversion, including real Redis and database integration cases. Verify the cache flush regression, failure and cancellation paths, authorization consumers, analyzer behavior and generated facade annotations. Full static analysis and formatting pass. Smoke-test the changed benchmark fixtures without changing benchmark measurements.
Note
Complete the framework test conversion to JMac
Doubleand fixGatepolicy resolutionVerifiesDoublesPHPUnit trait, and the newexpects/allows/ArgumentAPIs across Queue, Redis, Scout, Passport, Sentry, Grpc, OpenTelemetry, and other test areas. Several suites also replace mocked containers and configuration repositories with concrete instances.Gatepolicy resolution in Gate.php: policy caching now applies only to declared class names, and first arguments that are neither objects nor strings are excluded from policy identification.Canrule in Can.php to pass all configured argument values, including falsey ones, to Gate in positional order.MultiExectrait withpipeline/transactionmethods and a privateexecuteMultiExechelper on RedisProxy.php; RedisConnection::client now declares aRedis|RedisCluster|nullreturn type.ComposerAutoloadIsAuthoritativedoctor diagnostic, raises theext-redisconstraint to^6.3in composer.json, expands the cacheRepositorycontract with typed retrieval andputMany/flush, and documents production autoloader optimization.RedisProxymulti-exec now clears transaction watch state after a successful callback transaction, invalidates the context connection on exceptions, and releases newly created context connections;ext-redis ^6.3is now required.Macroscope summarized 6ddba98.