Repository navigation
Adopt Double across core framework tests - #746
Conversation
Audit real consumers and implementation semantics for behavior every conforming implementation must expose. Treat Hypervel contracts as greenfield interfaces rather than inheriting missing declarations from Laravel. Keep internal helpers and implementation-specific capabilities off general contracts, and update implementations, tests and public-contract documentation together during the audit.
Use Double for new test doubles and convert direct Mockery mocks and spies when porting from any upstream. Preserve upstream PHPUnit doubles and Mockery-backed framework helpers, with framework-owned cleanup and explicit Double verification. Explain lenient argument matching, overlapping allowed calls that bypass maximum counts, native fluent self-returns and static-return requirements. Retain concrete model fixtures for distinct instances and remove redundant guidance. Align the porting policy and checklists through links to the shared convention. Convert the Hypervel container and error-handler examples in the Hyperf guide, including the container control-name collision, while preserving the Hyperf source examples.
Add jasonmccreary/double ^1.1.1 as a development dependency for native test doubles and per-test verification. Retain Mockery for the framework testing APIs that expose its expectations and spies. This prepares the test conversion from Laravel framework PR #61947 at c980cb5827c6512c12ac44493d172a593b41299a. Dependencies are installed independently in the worktree; the root lock file remains untracked.
SES v2 ignores Source, and the envelope sender can describe the return path rather than the FromEmailAddress identity. Remove the unsupported parameter while preserving raw sender headers, explicit SES options and recipient handling. Replace transport mocks with the real SDK MockHandler and verify serialized HTTP payloads, message identifiers, tenant options and error behavior. Reconcile the transport test conversion from Laravel framework PR #61947 without mapping a bounce address to the sending identity. Validation: MailSesV2TransportTest, all three static-analysis configurations and repository formatting pass.
Only omitted or empty queue options mean no queue filter. Preserve the valid queue name 0, and filter only empty strings from retry job and batch identifiers so nonempty zero identifiers reach repository lookup and not-found diagnostics. Extend the existing regression datasets and convert the affected tests to native Double expectations and real SDK request handling. Preserve exact payloads, failure events and retry range behavior while reconciling Laravel framework PR #61947. Validation: both retry command test classes, all three static-analysis configurations and repository formatting pass.
Response assertions consume gatherData through the View contract to inspect effective rendering data, including shared values. Declare gatherData(): array on that contract instead of relying on an undeclared concrete capability. The standard View already implements it. Adapt the handwritten Markdown view fixture, document the requirement for custom implementations, and retain a source explanation of the deliberate Laravel contract difference. Convert TestResponse collaborators to native Double contracts while preserving streaming, JSON, session and model-identity coverage. Validation: TestResponseTest and MarkdownCoroutineSafetyTest pass, as do all three static-analysis configurations and repository formatting.
Reconcile Laravel framework PR #61947 against c980cb5827c6512c12ac44493d172a593b41299a. Use native Double collaborators with per-test verification, preserving meaningful argument, identity, ordering, required-call and forbidden-call assertions. Replace query and session plumbing mocks with real SQLite rows, HTTP requests and session state. Move Redis behavior into service integration coverage and exercise actual SDK command serialization. Remove obsolete database mock suites only after retaining their distinct coverage in integration tests. Preserve Hypervel coroutine ownership, cancellation, pooling, immutable dates, atomic publication, typed validation and cache behavior. Keep real fixtures for native static return types, explicit container collision handling, established unsupported-driver exclusions and framework-owned state cleanup. Mockery-backed framework testing APIs and their dedicated tests remain supported. Validation: every changed test class was run individually, including isolated Redis integration coverage. All three static-analysis configurations and repository formatting pass. The Redis SCAN_PREFIX regression runs in the existing Cluster CI job without a topology skip.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
|
@cubic-ai-dev review |
@binaryfire I have started the AI code review. It will take a few minutes to complete. |
PR Summary by QodoAdopt Double across core tests and strengthen behavioral coverage
AI Description
Diagram
High-Level Assessment
Files changed (222)
|
Code Review by Qodo
1. Stale-tag scan termination is no longer tested
|
There was a problem hiding this comment.
6 issues found across 225 files
Confidence score: 3/5
AuthenticateSessionTest.phpleaves a redirect callback installed, so later session tests can inherit the wrong redirect instead of checking the default. Clear the callback between tests.MailResendTransportTest.phpuses aClientdouble without the__getaccessor thatResendTransportuses, so the test can fail when it accesses the email service. Add the accessor or use a suitable client double.DatabaseConcernsPreventsCircularRecursionTest.phppasses whether caching works or not, so it will miss a regression in the behavior it names. Make the evaluated callback re-enter the same call.RedisStoreTest.phpchanges the tag score but leaves the stored value alive under its real TTL, so the test does not exercise value expiration. Delete the stored key or control its TTL.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="tests/Database/DatabaseConcernsPreventsCircularRecursionTest.php">
<violation number="1" location="tests/Database/DatabaseConcernsPreventsCircularRecursionTest.php:186">
P2: This assertion does not verify the behavior named by the test: a single non-recursive call produces `123` whether the evaluated call gets cached or bypasses caching. Make the evaluated callback re-enter the same call site with a sentinel default, or otherwise assert the cache/key fallback directly, so the test fails if evaluated code is incorrectly cached.</violation>
</file>
<file name="tests/Integration/Session/AuthenticateSessionTest.php">
<violation number="1" location="tests/Integration/Session/AuthenticateSessionTest.php:138">
P2: This test leaves a worker-lifetime redirect callback installed, so later session-mismatch tests inherit `/i-wanna-go-home` or `/session-mismatch` and no longer exercise the default `login` redirect. Flush `AuthenticateSession` state after the test, including when an assertion fails.</violation>
</file>
<file name="tests/Integration/Cache/Redis/RedisStoreTest.php">
<violation number="1" location="tests/Integration/Cache/Redis/RedisStoreTest.php:401">
P2: This test marks the tag membership expired without expiring the Redis value: `CarbonImmutable::setTestNow()` changes the sorted-set score, but `setex` still gives the value a real 60-second TTL. Delete the stored key or otherwise create a genuinely expired value before asserting stale-tag pruning, so the test does not provide false coverage.</violation>
</file>
<file name="tests/Database/MigratorTest.php">
<violation number="1" location="tests/Database/MigratorTest.php:303">
P2: These assertions now accept reordered or separately emitted output, so a migration can stop rendering one coherent bullet list or change task ordering while the test still passes. Preserve the expected output structure and sequence when asserting the buffered output instead of checking independent substrings globally.</violation>
</file>
<file name="AGENTS.md">
<violation number="1" location="AGENTS.md:638">
P3: This guidance incorrectly treats declaring-class return types like `self` and `static`; Double creates a fresh double for non-nullable class/interface return types. Document declaring-class methods as fresh doubles, or configure `returns($this)` when identity matters.</violation>
</file>
<file name="tests/Mail/MailResendTransportTest.php">
<violation number="1" location="tests/Mail/MailResendTransportTest.php:65">
P2: This anonymous `Client` implementation does not provide the SDK's `__get` service accessor used by `ResendTransport`; add the required accessor (returning the injected email service) or use a client test double that implements the full contract, otherwise these tests fail before exercising the transport.</violation>
</file>
Note: This PR contains a large number of files. cubic selects up to 200 of the highest-priority eligible files for this review, so some files may not have been reviewed.
View guided diff | Turn on auto-fix | Re-trigger cubic
[Medium impact] The PR appears safe to merge; no new actionable issues were established. SummaryAdopts Double across core framework tests while retaining Mockery-backed framework helpers and existing PHPUnit doubles.
Reviews (2) · Last reviewed commit: "test: retain behavioral coverage after D..." · Reviewed by Greptile |
Exercise translation registration both before and after translator resolution, and verify that changing a password during an authenticated request refreshes the stored session hash. Validate serialized SQS command names and restored job types, with a concrete message-group state assertion. Require the nullable route lookups so lenient defaults cannot hide a wrong parameter, and inspect unmatched relationship state without lazy-loading it. Make the existing attach-touch test distinguish creation and attachment timestamps. Clarify that backdated Redis membership scores isolate expiry pruning from orphan cleanup rather than adding duplicate scan instrumentation. Validation: all seven changed test classes pass, including isolated Redis integration coverage. Formatting and whitespace checks pass; production code is unchanged.
|
The stale-tag scan-termination coverage remains in the owning operation tests. |
Test doubles and real behavior
Adopt Double across core framework tests, following Laravel's test conversion. Mockery-backed framework helpers and their integration tests remain supported, as do existing upstream PHPUnit doubles.
Related fixes
Sourceparameter from the SES v2 transport, preserving raw sender headers and explicit SES options."0"and nonempty zero identifiers in retry commands.gatherData(): arrayon the View contract because response assertions consume effective rendering data, including shared values. Custom View implementations must provide it; the standard View already does. Document this contract difference and track a broader contract-completeness audit.Validation
Changed test classes and isolated Redis integration tests pass locally. Static analysis and formatting pass. The existing Redis Cluster CI job also covers the prefix regression without a Cluster skip.
Note
Adopt JMac
Doubleacross core framework tests and remove MockeryVerifiesDoublestrait across queue, cache, database, mail, auth, events, view, and support tests; addsjasonmccreary/double^1.1.1 to composer.json.createOrFirst,firstOrCreate,updateOrCreate,belongsToMany,hasManyThrough) to run against in-memory SQLite with separate read/write databases instead of mocked connections, adding coverage for replica reads and cross-parent isolation.MockHandlerin SQS and SES v2 tests, and swaps mocked clocks forCarbonImmutable's test clock.SesV2Transport::doSendto stop sending the v1-onlySourceparameter in SES v2 requests.AuthenticateSessionunit cases — some re-homed as integration tests); several assertion values change (e.g. pluck key nownull,read_atnowCarbonImmutable, upsert timestamp key order).Macroscope summarized 5568bb0.