Skip to content

Adopt Double across core framework tests - #746

Merged
binaryfire merged 8 commits into
0.4from
upstream-sync-double-2026-11-16
Nov 16, 2026
Merged

binaryfire merged 8 commits into
0.4from
upstream-sync-double-2026-11-16

Conversation

@binaryfire

@binaryfire binaryfire commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

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.

  • Replace direct Mockery mocks and spies with native Double collaborators and per-test verification.
  • Exercise real database rows, HTTP requests, sessions and SDK requests where the old tests mocked implementation details.
  • Move Redis behavior into service integration tests and consolidate replaced database coverage without losing distinct assertions.
  • Preserve Hypervel's coroutine isolation, cancellation, connection ownership, atomic writes and typed validation coverage.
  • Update testing and porting guidance so new tests use Double and future ports convert direct Mockery usage consistently.

Related fixes

  • Remove the ignored SES v1 Source parameter from the SES v2 transport, preserving raw sender headers and explicit SES options.
  • Preserve queue name "0" and nonempty zero identifiers in retry commands.
  • Declare gatherData(): array on 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.

View guided diff Turn on auto-fix

Note

Adopt JMac Double across core framework tests and remove Mockery

  • Replaces Mockery mocks with JMac testing doubles and the PHPUnit VerifiesDoubles trait across queue, cache, database, mail, auth, events, view, and support tests; adds jasonmccreary/double ^1.1.1 to composer.json.
  • Rewrites Eloquent relation tests (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.
  • Replaces mocked AWS clients with the SDK's MockHandler in SQS and SES v2 tests, and swaps mocked clocks for CarbonImmutable's test clock.
  • Fixes SesV2Transport::doSend to stop sending the v1-only Source parameter in SES v2 requests.
  • Behavioral Change: removes a number of existing test cases (e.g. HasOne default-value tests, model destroy/update-process tests, database queue payload checks, AuthenticateSession unit cases — some re-homed as integration tests); several assertion values change (e.g. pluck key now null, read_at now CarbonImmutable, upsert timestamp key order).

Macroscope summarized 5568bb0.

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.
@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

@binaryfire

Copy link
Copy Markdown
Member Author

@cubic-ai-dev review

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 16, 2026

Copy link
Copy Markdown

@cubic-ai-dev review

@binaryfire I have started the AI code review. It will take a few minutes to complete.

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

Copy link
Copy Markdown

PR Summary by Qodo

Adopt Double across core tests and strengthen behavioral coverage

🧪 Tests 🐞 Bug fix ✨ Enhancement 📝 Documentation ⚙️ Configuration changes 🕐 40+ Minutes

Grey Divider

AI Description

• Convert direct Mockery collaborators to Double while retaining framework-backed helpers and
 upstream PHPUnit doubles.
• Replace implementation-detail mocks with database, Redis, HTTP, session, and SDK behavior tests.
• Fix SES v2 sender handling, zero-valued retry identifiers, and the View rendering-data contract.
Diagram

graph TD
  T["Core tests"] --> D["Double collaborators"] --> F["Framework components"]
  T --> I["Behavioral integrations"] --> F
  I --> E["Database Redis SDK"]
  F --> C["View contract"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep mock-heavy unit coverage
  • ➕ Smaller test migration
  • ➕ Faster isolated tests
  • ➖ Continues coupling assertions to implementation details
  • ➖ Does not verify persisted rows, HTTP sessions, or SDK requests
2. Convert every double, including framework helpers
  • ➕ Uniform test-double API
  • ➖ Would stop testing supported Mockery-backed framework APIs
  • ➖ Would unnecessarily rewrite upstream PHPUnit doubles

Recommendation: Retain the PR’s selective approach: use Double for direct collaborators, real integrations for externally visible behavior, and existing doubles where they are part of the supported API or upstream test design. Review relocated assertions carefully to ensure no distinct behavior was lost.

Files changed (222) +13002 / -14013

Enhancement (1) +8 / -0
View.phpDeclare effective view rendering data +8/-0

Declare effective view rendering data

• Adds gatherData(): array so response assertions can access rendering data, including shared values, through the contract.

src/contracts/src/View/View.php

Bug fix (3) +10 / -4
SesV2Transport.phpRemove unsupported SES v1 Source field +2/-1

Remove unsupported SES v1 Source field

• Stops sending Source to SES v2 while retaining raw sender headers and explicit options.

src/mail/src/Transport/SesV2Transport.php

RetryBatchCommand.phpRetain zero-valued batch job IDs +2/-1

Retain zero-valued batch job IDs

• Filters only empty IDs, preserving nonempty zero identifiers for retry.

src/queue/src/Console/RetryBatchCommand.php

RetryCommand.phpPreserve queue zero and failed job ID zero +6/-2

Preserve queue zero and failed job ID zero

• Distinguishes omitted queue options from "0" and retains nonempty zero IDs.

src/queue/src/Console/RetryCommand.php

Tests (212) +12938 / -13972
AuthDatabaseUserProviderTest.phpConvert database provider collaborators +45/-42

Convert database provider collaborators

• Uses Double to verify database-backed authentication provider behavior.

tests/Auth/AuthDatabaseUserProviderTest.php

AuthEloquentUserProviderTest.phpConvert Eloquent provider collaborators +13/-11

Convert Eloquent provider collaborators

• Replaces direct Mockery setup while retaining provider assertions.

tests/Auth/AuthEloquentUserProviderTest.php

AuthGuardTest.phpConvert guard behavior tests +279/-352

Convert guard behavior tests

• Uses Double collaborators for authentication guard interactions and verification.

tests/Auth/AuthGuardTest.php

AuthPasswordBrokerManagerTest.phpConvert password broker manager tests +51/-52

Convert password broker manager tests

• Migrates direct mocked dependencies to Double.

tests/Auth/AuthPasswordBrokerManagerTest.php

AuthPasswordBrokerTest.phpConvert password broker tests +67/-65

Convert password broker tests

• Uses Double expectations for broker dependencies and outcomes.

tests/Auth/AuthPasswordBrokerTest.php

AuthTokenGuardTest.phpConvert token guard tests +92/-89

Convert token guard tests

• Uses Double to exercise token lookup and guard behavior.

tests/Auth/AuthTokenGuardTest.php

AuthenticateMiddlewareTest.phpConvert authentication middleware tests +9/-6

Convert authentication middleware tests

• Replaces direct Mockery collaborators with verified Doubles.

tests/Auth/AuthenticateMiddlewareTest.php

Ably2BroadcasterTest.phpConvert Ably2 broadcaster tests +10/-9

Convert Ably2 broadcaster tests

• Uses Double for broadcaster collaborators.

tests/Broadcasting/Ably2BroadcasterTest.php

AblyBroadcasterTest.phpConvert Ably broadcaster tests +47/-35

Convert Ably broadcaster tests

• Migrates client expectations to Double and retains broadcast assertions.

tests/Broadcasting/AblyBroadcasterTest.php

BroadcastEventTest.phpConvert broadcast event tests +33/-25

Convert broadcast event tests

• Verifies dispatch behavior through Double collaborators.

tests/Broadcasting/BroadcastEventTest.php

BroadcasterTest.phpConvert base broadcaster tests +70/-72

Convert base broadcaster tests

• Reworks mocked broadcaster interactions using Double.

tests/Broadcasting/BroadcasterTest.php

MercureBroadcasterTest.phpConvert Mercure broadcaster tests +81/-56

Convert Mercure broadcaster tests

• Uses Double to verify Mercure requests and responses.

tests/Broadcasting/MercureBroadcasterTest.php

PusherBroadcasterTest.phpConvert Pusher broadcaster tests +65/-56

Convert Pusher broadcaster tests

• Migrates Pusher client expectations to Double.

tests/Broadcasting/PusherBroadcasterTest.php

RedisBroadcasterTest.phpConvert Redis broadcaster tests +89/-68

Convert Redis broadcaster tests

• Verifies Redis publication through Double collaborators.

tests/Broadcasting/RedisBroadcasterTest.php

BusBatchTest.phpConvert batch lifecycle tests +81/-70

Convert batch lifecycle tests

• Uses Double for batch repository and dispatch collaborators.

tests/Bus/BusBatchTest.php

BusBatchableTest.phpConvert batchable job tests +10/-7

Convert batchable job tests

• Replaces direct mocked collaborators with Double.

tests/Bus/BusBatchableTest.php

BusDispatcherTest.phpConvert bus dispatcher tests +28/-24

Convert bus dispatcher tests

• Migrates dispatcher collaborator expectations to Double.

tests/Bus/BusDispatcherTest.php

BusPendingBatchTest.phpConvert pending batch tests +76/-69

Convert pending batch tests

• Uses verified Double collaborators for pending batch behavior.

tests/Bus/BusPendingBatchTest.php

BusPendingDispatchTest.phpConvert pending dispatch tests +66/-43

Convert pending dispatch tests

• Migrates dispatch expectations to Double while retaining lifecycle assertions.

tests/Bus/BusPendingDispatchTest.php

CacheDatabaseStoreTest.phpExercise database cache behavior +107/-148

Exercise database cache behavior

• Reworks mocked storage expectations toward observable database store behavior.

tests/Cache/CacheDatabaseStoreTest.php

CacheEventsTest.phpConvert cache event tests +39/-36

Convert cache event tests

• Uses Double to verify cache event dispatch.

tests/Cache/CacheEventsTest.php

CacheFailoverStoreTest.phpConvert failover cache tests +121/-116

Convert failover cache tests

• Verifies fallback and failure paths using Double stores.

tests/Cache/CacheFailoverStoreTest.php

CacheFileStoreTest.phpConvert file cache tests +21/-15

Convert file cache tests

• Replaces direct mocked collaborators with Double.

tests/Cache/CacheFileStoreTest.php

CacheManagerTest.phpConvert cache manager tests +44/-62

Convert cache manager tests

• Uses Double for manager collaborators while retaining driver assertions.

tests/Cache/CacheManagerTest.php

CacheRedisStoreTest.phpMove Redis store behavior into integrations +12/-247

Move Redis store behavior into integrations

• Removes implementation-detail Redis mocks; keeps focused isolated store coverage.

tests/Cache/CacheRedisStoreTest.php

CacheRepositoryTest.phpConvert cache repository tests +240/-236

Convert cache repository tests

• Uses Double store expectations for repository behavior.

tests/Cache/CacheRepositoryTest.php

ClearCommandTest.phpConvert cache clear command tests +78/-53

Convert cache clear command tests

• Verifies command interactions with Double collaborators.

tests/Cache/ClearCommandTest.php

PutManyTest.phpAdjust Redis put-many assertion +1/-1

Adjust Redis put-many assertion

• Aligns the operation test with the converted Redis coverage.

tests/Cache/Redis/Operations/PutManyTest.php

RedisStoreTest.phpStrengthen Redis store unit coverage +42/-13

Strengthen Redis store unit coverage

• Updates Redis store assertions alongside relocated integration behavior.

tests/Cache/Redis/RedisStoreTest.php

CacheCommandMutexTest.phpConvert cache command mutex tests +29/-33

Convert cache command mutex tests

• Uses Double for cache-backed mutex collaborators.

tests/Console/CacheCommandMutexTest.php

CommandMutexTest.phpConvert command mutex tests +26/-21

Convert command mutex tests

• Migrates mutex interaction expectations to Double.

tests/Console/CommandMutexTest.php

CommandTest.phpConvert console command tests +43/-41

Convert console command tests

• Replaces direct Mockery collaborators with Double.

tests/Console/CommandTest.php

ConsoleApplicationTest.phpConvert console application tests +10/-5

Convert console application tests

• Uses verified Doubles for application collaborators.

tests/Console/ConsoleApplicationTest.php

EventTest.phpConvert scheduled event tests +140/-141

Convert scheduled event tests

• Migrates scheduling collaborator expectations to Double.

tests/Console/Scheduling/EventTest.php

ScheduleTest.phpConvert schedule tests +38/-39

Convert schedule tests

• Uses Double for scheduler collaborators while retaining scheduling assertions.

tests/Console/Scheduling/ScheduleTest.php

ContextualAttributeBindingTest.phpConvert contextual binding tests +80/-77

Convert contextual binding tests

• Uses Double to verify container attribute bindings.

tests/Container/ContextualAttributeBindingTest.php

DatabaseConcernsHasAttributesTest.phpSimplify attribute concern coverage +6/-11

Simplify attribute concern coverage

• Removes direct mocked setup while retaining attribute behavior assertions.

tests/Database/DatabaseConcernsHasAttributesTest.php

DatabaseConcernsPreventsCircularRecursionTest.phpSimplify recursion concern tests +4/-14

Simplify recursion concern tests

• Replaces implementation-detail mocking with concrete behavior checks.

tests/Database/DatabaseConcernsPreventsCircularRecursionTest.php

DatabaseConnectionFactoryTest.phpConvert connection factory tests +20/-15

Convert connection factory tests

• Uses Double for connection factory collaborators.

tests/Database/DatabaseConnectionFactoryTest.php

DatabaseConnectionTest.phpConvert connection behavior tests +245/-213

Convert connection behavior tests

• Uses Double for database connection dependencies and preserves connection assertions.

tests/Database/DatabaseConnectionTest.php

DatabaseConnectorTest.phpConvert connector tests +41/-38

Convert connector tests

• Migrates connector dependency expectations to Double.

tests/Database/DatabaseConnectorTest.php

DatabaseEloquentAsVectorCastTest.phpConvert vector cast tests +8/-5

Convert vector cast tests

• Replaces direct mock setup with Double.

tests/Database/DatabaseEloquentAsVectorCastTest.php

DatabaseEloquentBelongsToManyCreateOrFirstTest.phpExercise belongs-to-many create-or-first behavior +216/-404

Exercise belongs-to-many create-or-first behavior

• Consolidates mocked relationship scenarios around actual database operations.

tests/Database/DatabaseEloquentBelongsToManyCreateOrFirstTest.php

DatabaseEloquentBelongsToTest.phpConvert belongs-to relationship tests +25/-22

Convert belongs-to relationship tests

• Uses Double for isolated relationship collaborators.

tests/Database/DatabaseEloquentBelongsToTest.php

DatabaseEloquentBuilderCreateOrFirstTest.phpExercise builder create-or-first behavior +225/-523

Exercise builder create-or-first behavior

• Replaces extensive mocked query expectations with database-backed outcomes.

tests/Database/DatabaseEloquentBuilderCreateOrFirstTest.php

DatabaseEloquentBuilderTest.phpRefocus Eloquent builder tests +355/-548

Refocus Eloquent builder tests

• Converts remaining collaborators and moves behavior assertions away from mocked internals.

tests/Database/DatabaseEloquentBuilderTest.php

DatabaseEloquentCollectionQueueableTest.phpConvert queueable collection tests +12/-13

Convert queueable collection tests

• Uses Double where collection tests require collaborators.

tests/Database/DatabaseEloquentCollectionQueueableTest.php

DatabaseEloquentCollectionTest.phpConvert Eloquent collection tests +22/-19

Convert Eloquent collection tests

• Replaces direct Mockery usage with Double.

tests/Database/DatabaseEloquentCollectionTest.php

DatabaseEloquentFactoryTest.phpConvert Eloquent factory tests +13/-10

Convert Eloquent factory tests

• Uses Double for factory collaborators.

tests/Database/DatabaseEloquentFactoryTest.php

DatabaseEloquentHasManyCreateOrFirstTest.phpExercise has-many create-or-first behavior +219/-307

Exercise has-many create-or-first behavior

• Consolidates mocked cases into database-backed relationship assertions.

tests/Database/DatabaseEloquentHasManyCreateOrFirstTest.php

DatabaseEloquentHasManyTest.phpRelocate mocked has-many assertions +2/-62

Relocate mocked has-many assertions

• Removes implementation-detail cases now covered by relationship integrations.

tests/Database/DatabaseEloquentHasManyTest.php

DatabaseEloquentHasManyThroughCreateOrFirstTest.phpExercise has-many-through creation behavior +125/-283

Exercise has-many-through creation behavior

• Replaces mocked creation expectations with persisted relationship checks.

tests/Database/DatabaseEloquentHasManyThroughCreateOrFirstTest.php

DatabaseEloquentHasOneTest.phpRelocate mocked has-one assertions +6/-102

Relocate mocked has-one assertions

• Removes relationship implementation mocks in favor of behavioral coverage.

tests/Database/DatabaseEloquentHasOneTest.php

DatabaseEloquentIntegrationTest.phpConsolidate Eloquent integration coverage +719/-1

Consolidate Eloquent integration coverage

• Adds database-backed relationship, upsert, model, and attribute cases formerly asserted through mocks.

tests/Database/DatabaseEloquentIntegrationTest.php

DatabaseEloquentInverseRelationTest.phpConvert inverse relation tests +68/-64

Convert inverse relation tests

• Uses Double for isolated inverse relationship collaborators.

tests/Database/DatabaseEloquentInverseRelationTest.php

DatabaseEloquentModelTest.phpRefocus Eloquent model unit tests +127/-802

Refocus Eloquent model unit tests

• Removes obsolete mocked cases and converts remaining collaborators; behavioral cases move to integrations.

tests/Database/DatabaseEloquentModelTest.php

DatabaseEloquentMorphTest.phpRelocate morph relationship assertions +0/-53

Relocate morph relationship assertions

• Removes mocked cases covered by integration tests.

tests/Database/DatabaseEloquentMorphTest.php

DatabaseEloquentMorphToTest.phpConvert morph-to tests +33/-43

Convert morph-to tests

• Migrates isolated polymorphic relationship collaborators to Double.

tests/Database/DatabaseEloquentMorphToTest.php

DatabaseEloquentPivotTest.phpConvert pivot tests +31/-28

Convert pivot tests

• Uses Double for pivot collaborators.

tests/Database/DatabaseEloquentPivotTest.php

DatabaseEloquentPolymorphicRelationsIntegrationTest.phpExtend polymorphic integration assertions +8/-1

Extend polymorphic integration assertions

• Adds behavior checks replacing mocked polymorphic cases.

tests/Database/DatabaseEloquentPolymorphicRelationsIntegrationTest.php

DatabaseEloquentRelationshipsTest.phpStrengthen relationship coverage +20/-8

Strengthen relationship coverage

• Adds assertions for real relationship behavior.

tests/Database/DatabaseEloquentRelationshipsTest.php

DatabaseEloquentSoftDeletesIntegrationTest.phpConsolidate soft-delete integration coverage +100/-17

Consolidate soft-delete integration coverage

• Adds database-backed soft-delete and scope scenarios previously dependent on mocks.

tests/Database/DatabaseEloquentSoftDeletesIntegrationTest.php

DatabaseManagerTest.phpConvert database manager tests +13/-6

Convert database manager tests

• Uses Double for manager dependencies.

tests/Database/DatabaseManagerTest.php

DatabaseMariaDbBuilderTest.phpConvert MariaDB builder tests +12/-9

Convert MariaDB builder tests

• Migrates isolated builder collaborators to Double.

tests/Database/DatabaseMariaDbBuilderTest.php

DatabaseMariaDbQueryGrammarTest.phpConvert MariaDB query grammar tests +11/-8

Convert MariaDB query grammar tests

• Uses Double for grammar collaborators.

tests/Database/DatabaseMariaDbQueryGrammarTest.php

DatabaseMariaDbSchemaBuilderTest.phpConvert MariaDB schema builder tests +15/-12

Convert MariaDB schema builder tests

• Replaces direct mocks with Double.

tests/Database/DatabaseMariaDbSchemaBuilderTest.php

DatabaseMariaDbSchemaGrammarTest.phpConvert MariaDB schema grammar tests +62/-60

Convert MariaDB schema grammar tests

• Uses Double to verify grammar dependencies.

tests/Database/DatabaseMariaDbSchemaGrammarTest.php

DatabaseMigrationCreatorTest.phpConvert migration creator tests +30/-27

Convert migration creator tests

• Migrates creator dependency expectations to Double.

tests/Database/DatabaseMigrationCreatorTest.php

DatabaseMigrationInstallCommandTest.phpConvert migration install tests +16/-22

Convert migration install tests

• Replaces direct mock command dependencies with Double.

tests/Database/DatabaseMigrationInstallCommandTest.php

DatabaseMigrationMakeCommandTest.phpConvert migration make tests +14/-16

Convert migration make tests

• Uses Double for command collaborators.

tests/Database/DatabaseMigrationMakeCommandTest.php

DatabaseMigrationMigrateCommandTest.phpConvert migrate command tests +86/-83

Convert migrate command tests

• Migrates migrator expectations to Double.

tests/Database/DatabaseMigrationMigrateCommandTest.php

DatabaseMigrationRefreshCommandTest.phpConvert refresh command tests +43/-74

Convert refresh command tests

• Reworks mocked migration command collaborators with Double.

tests/Database/DatabaseMigrationRefreshCommandTest.php

DatabaseMigrationRepositoryTest.phpConvert migration repository tests +44/-41

Convert migration repository tests

• Uses Double for repository storage collaborators.

tests/Database/DatabaseMigrationRepositoryTest.php

DatabaseMigrationResetCommandTest.phpConvert reset command tests +17/-18

Convert reset command tests

• Migrates command expectations to Double.

tests/Database/DatabaseMigrationResetCommandTest.php

DatabaseMigrationRollbackCommandTest.phpConvert rollback command tests +24/-26

Convert rollback command tests

• Uses Double for rollback dependencies.

tests/Database/DatabaseMigrationRollbackCommandTest.php

DatabaseMigrationStatusCommandTest.phpRemove redundant status mutex mock +0/-5

Remove redundant status mutex mock

• Drops a mocked mutex binding from the application fixture.

tests/Database/DatabaseMigrationStatusCommandTest.php

DatabaseMigratorIntegrationTest.phpStrengthen migrator integration tests +8/-5

Strengthen migrator integration tests

• Adds real migration assertions alongside converted coverage.

tests/Database/DatabaseMigratorIntegrationTest.php

DatabaseMigratorTest.phpConvert migrator tests +64/-61

Convert migrator tests

• Uses Double for isolated migration dependencies.

tests/Database/DatabaseMigratorTest.php

DatabaseMySQLSchemaBuilderTest.phpConvert MySQL schema builder tests +15/-12

Convert MySQL schema builder tests

• Migrates direct mocked collaborators to Double.

tests/Database/DatabaseMySQLSchemaBuilderTest.php

DatabaseMySqlBuilderTest.phpConvert MySQL builder tests +57/-56

Convert MySQL builder tests

• Uses Double for query builder dependencies.

tests/Database/DatabaseMySqlBuilderTest.php

DatabaseMySqlQueryGrammarTest.phpConvert MySQL query grammar tests +14/-11

Convert MySQL query grammar tests

• Migrates grammar collaborators to Double.

tests/Database/DatabaseMySqlQueryGrammarTest.php

DatabaseMySqlSchemaGrammarTest.phpConvert MySQL schema grammar tests +67/-66

Convert MySQL schema grammar tests

• Uses Double in schema generation assertions.

tests/Database/DatabaseMySqlSchemaGrammarTest.php

DatabasePdoConnectionTest.phpConvert PDO connection tests +63/-48

Convert PDO connection tests

• Uses Double for typed PDO and connection collaborators.

tests/Database/DatabasePdoConnectionTest.php

DatabasePostgresBuilderTest.phpConvert PostgreSQL builder tests +171/-173

Convert PostgreSQL builder tests

• Migrates builder interaction expectations to Double.

tests/Database/DatabasePostgresBuilderTest.php

DatabasePostgresQueryGrammarTest.phpConvert PostgreSQL query grammar tests +13/-10

Convert PostgreSQL query grammar tests

• Uses Double for grammar collaborators.

tests/Database/DatabasePostgresQueryGrammarTest.php

DatabasePostgresSchemaBuilderTest.phpConvert PostgreSQL schema builder tests +15/-12

Convert PostgreSQL schema builder tests

• Replaces direct mocks with Double.

tests/Database/DatabasePostgresSchemaBuilderTest.php

DatabasePostgresSchemaGrammarTest.phpConvert PostgreSQL schema grammar tests +29/-25

Convert PostgreSQL schema grammar tests

• Migrates schema grammar dependencies to Double.

tests/Database/DatabasePostgresSchemaGrammarTest.php

DatabaseProcessorTest.phpConvert database processor tests +13/-10

Convert database processor tests

• Uses Double for processor collaborators.

tests/Database/DatabaseProcessorTest.php

DatabaseQueryBuilderTest.phpConvert query builder tests +477/-401

Convert query builder tests

• Migrates extensive connection and grammar expectations to Double.

tests/Database/DatabaseQueryBuilderTest.php

DatabaseQueryExceptionTest.phpStrengthen query exception tests +23/-8

Strengthen query exception tests

• Adjusts typed connection fixtures and exception assertions.

tests/Database/DatabaseQueryExceptionTest.php

DatabaseSQLiteSchemaGrammarTest.phpConvert SQLite schema grammar tests +37/-45

Convert SQLite schema grammar tests

• Uses Double for schema grammar collaborators.

tests/Database/DatabaseSQLiteSchemaGrammarTest.php

DatabaseSchemaBlueprintTest.phpConvert schema blueprint tests +34/-34

Convert schema blueprint tests

• Migrates blueprint dependency expectations to Double.

tests/Database/DatabaseSchemaBlueprintTest.php

DatabaseSchemaBuilderTest.phpConvert schema builder tests +101/-98

Convert schema builder tests

• Uses Double for database schema collaborators.

tests/Database/DatabaseSchemaBuilderTest.php

DatabaseSeederTest.phpConvert seeder tests +21/-18

Convert seeder tests

• Migrates seeding expectations to Double.

tests/Database/DatabaseSeederTest.php

DatabaseSoftDeletingScopeTest.phpConsolidate soft-delete scope cases +0/-53

Consolidate soft-delete scope cases

• Removes mocked cases now exercised against real database state.

tests/Database/DatabaseSoftDeletingScopeTest.php

DatabaseSoftDeletingTraitTest.phpConsolidate soft-delete trait cases +0/-145

Consolidate soft-delete trait cases

• Moves implementation-detail checks into soft-delete integration coverage.

tests/Database/DatabaseSoftDeletingTraitTest.php

DatabaseSqliteSchemaStateTest.phpConvert SQLite schema state tests +23/-19

Convert SQLite schema state tests

• Uses Double for schema state collaborators.

tests/Database/DatabaseSqliteSchemaStateTest.php

DatabaseTransactionsTest.phpConvert transaction tests +31/-28

Convert transaction tests

• Migrates connection expectations to Double.

tests/Database/DatabaseTransactionsTest.php

DatabaseWipeCommandTest.phpRemove redundant wipe mutex mock +0/-5

Remove redundant wipe mutex mock

• Drops a mocked command mutex binding from the application fixture.

tests/Database/DatabaseWipeCommandTest.php

MigratorTest.phpConvert additional migrator tests +41/-52

Convert additional migrator tests

• Uses Double for migration repository and connection collaborators.

tests/Database/MigratorTest.php

PruneCommandTest.phpConvert prune command tests +12/-9

Convert prune command tests

• Migrates command collaborators to Double.

tests/Database/PruneCommandTest.php

SeedCommandTest.phpConvert seed command tests +44/-51

Convert seed command tests

• Replaces direct mocked collaborators with Double.

tests/Database/SeedCommandTest.php

BroadcastedEventsTest.phpConvert broadcast event tests +40/-25

Convert broadcast event tests

• Uses Double for event broadcasting collaborators.

tests/Events/BroadcastedEventsTest.php

EventsSubscriberTest.phpConvert subscriber tests +7/-3

Convert subscriber tests

• Migrates subscriber collaborator setup to Double.

tests/Events/EventsSubscriberTest.php

QueuedEventsTest.phpConvert queued event tests +105/-96

Convert queued event tests

• Uses Double to verify queue and event interactions.

tests/Events/QueuedEventsTest.php

FilesystemAdapterTest.phpConvert filesystem adapter tests +94/-77

Convert filesystem adapter tests

• Migrates filesystem collaborator expectations to Double.

tests/Filesystem/FilesystemAdapterTest.php

FilesystemTest.phpConvert filesystem tests +6/-3

Convert filesystem tests

• Replaces direct mocks with Double.

tests/Filesystem/FilesystemTest.php

HandleExceptionsTest.phpConvert bootstrap exception tests +45/-37

Convert bootstrap exception tests

• Uses Double for exception handler collaborators.

tests/Foundation/Bootstrap/HandleExceptionsTest.php

ListenerTest.phpConvert renderer listener tests +10/-7

Convert renderer listener tests

• Migrates listener dependency expectations to Double.

tests/Foundation/Exceptions/Renderer/ListenerTest.php

FoundationAuthenticationTest.phpConvert foundation authentication tests +18/-13

Convert foundation authentication tests

• Uses Double for authentication collaborators.

tests/Foundation/FoundationAuthenticationTest.php

FoundationCacheBasedMaintenanceModeTest.phpConvert maintenance cache tests +25/-23

Convert maintenance cache tests

• Migrates cache-backed maintenance expectations to Double.

tests/Foundation/FoundationCacheBasedMaintenanceModeTest.php

FoundationExceptionsHandlerTest.phpConvert exception handler tests +96/-81

Convert exception handler tests

• Uses Double to verify exception handling dependencies.

tests/Foundation/FoundationExceptionsHandlerTest.php

FoundationFormRequestTest.phpConvert form request tests +18/-15

Convert form request tests

• Replaces direct mocks with Double while retaining request assertions.

tests/Foundation/FoundationFormRequestTest.php

FoundationInteractsWithDatabaseTest.phpConvert database testing concern tests +67/-65

Convert database testing concern tests

• Uses Double for isolated testing concern collaborators.

tests/Foundation/FoundationInteractsWithDatabaseTest.php

InteractsWithDatabaseTest.phpConvert database interaction tests +11/-9

Convert database interaction tests

• Migrates testing concern dependencies to Double.

tests/Foundation/Testing/Concerns/InteractsWithDatabaseTest.php

DatabaseTruncationTest.phpConvert truncation tests +54/-51

Convert truncation tests

• Uses Double for truncation connection collaborators.

tests/Foundation/Testing/DatabaseTruncationTest.php

LazilyRefreshDatabaseTest.phpConvert lazy refresh tests +5/-3

Convert lazy refresh tests

• Replaces direct mocked collaborators with Double.

tests/Foundation/Testing/LazilyRefreshDatabaseTest.php

HttpRedirectResponseTest.phpConvert redirect response tests +8/-5

Convert redirect response tests

• Uses Double for redirect collaborators.

tests/Http/HttpRedirectResponseTest.php

HttpResponseTest.phpConvert HTTP response tests +6/-3

Convert HTTP response tests

• Migrates response collaborators to Double.

tests/Http/HttpResponseTest.php

JsonResourceTest.phpSimplify JSON resource tests +3/-5

Simplify JSON resource tests

• Removes implementation-detail mocking from resource coverage.

tests/Http/JsonResourceTest.php

PreventRequestForgeryTest.phpSimplify request forgery tests +2/-3

Simplify request forgery tests

• Adjusts fixtures to exercise middleware behavior directly.

tests/Http/Middleware/PreventRequestForgeryTest.php

ImageManagerTest.phpConvert image manager tests +48/-48

Convert image manager tests

• Uses Double for image manager dependencies.

tests/Image/ImageManagerTest.php

RedisStoreTest.phpExercise real Redis cache operations +137/-5

Exercise real Redis cache operations

• Adds integration assertions for values, expiry, tags, and store behavior previously checked through mocked commands.

tests/Integration/Cache/Redis/RedisStoreTest.php

DatabaseLockTest.phpConvert database lock integration tests +50/-46

Convert database lock integration tests

• Uses Double where needed while retaining real lock and ownership assertions.

tests/Integration/Database/DatabaseLockTest.php

ListenerTest.phpExtend listener integration coverage +11/-0

Extend listener integration coverage

• Adds observable event listener behavior assertions.

tests/Integration/Events/ListenerTest.php

ConfigCacheCommandTest.phpConvert config-cache integration tests +13/-9

Convert config-cache integration tests

• Migrates direct mock dependencies to Double.

tests/Integration/Foundation/Console/ConfigCacheCommandTest.php

EventCacheCommandTest.phpConvert event-cache integration tests +13/-8

Convert event-cache integration tests

• Uses Double for isolated command collaborators.

tests/Integration/Foundation/Console/EventCacheCommandTest.php

RouteCacheCommandTest.phpConvert route-cache integration tests +13/-9

Convert route-cache integration tests

• Migrates collaborator expectations to Double.

tests/Integration/Foundation/Console/RouteCacheCommandTest.php

MaintenanceModeTest.phpConvert maintenance integration tests +30/-26

Convert maintenance integration tests

• Uses Double alongside real maintenance behavior assertions.

tests/Integration/Foundation/MaintenanceModeTest.php

CallQueuedHandlerTest.phpConvert queued handler integration tests +62/-57

Convert queued handler integration tests

• Uses Double for handler collaborators while retaining queue behavior.

tests/Integration/Queue/CallQueuedHandlerTest.php

QueueConnectionTest.phpConvert queue connection integrations +30/-27

Convert queue connection integrations

• Migrates isolated dependencies to Double.

tests/Integration/Queue/QueueConnectionTest.php

RedisQueueTest.phpStrengthen real Redis queue coverage +104/-33

Strengthen real Redis queue coverage

• Moves queue behavior assertions to Redis-backed integration tests.

tests/Integration/Queue/Redis/RedisQueueTest.php

SkipIfBatchCancelledTest.phpConvert cancellation integration tests +9/-6

Convert cancellation integration tests

• Uses Double while preserving batch cancellation assertions.

tests/Integration/Queue/SkipIfBatchCancelledTest.php

WorkCommandTest.phpConvert worker command integrations +10/-7

Convert worker command integrations

• Migrates direct mocked dependencies to Double.

tests/Integration/Queue/WorkCommandTest.php

AuthenticateSessionTest.phpExercise authentication through HTTP sessions +294/-0

Exercise authentication through HTTP sessions

• Adds real routes, users, requests, and session assertions for authentication middleware, including remember-login behavior.

tests/Integration/Session/AuthenticateSessionTest.php

MailMailableTest.phpConvert mailable tests +58/-70

Convert mailable tests

• Uses Double for isolated mail rendering and dispatch collaborators.

tests/Mail/MailMailableTest.php

MailMailerTest.phpConvert mailer tests +25/-19

<br...

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

qodo-free-for-open-source-projects Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Informational

1. Stale-tag scan termination is no longer tested 🐞 Bug ⚙ Maintainability
Description
The removed CacheRedisStoreTest stale-tag case asserted `assertSame(1,
$client->getScanCallCount()), which proved flushStaleTags()` stops scanning once the cursor
returns zero. The replacement integration tests in
tests/Integration/Cache/Redis/RedisStoreTest.php only check that stale entries are removed and
that prefixes are handled, so a regression that keeps scanning after the cursor reaches zero, or
loops forever, would go unnoticed.
Code

tests/Cache/CacheRedisStoreTest.php[R38-41]

+    /**
+     * Create a Redis store without opening a connection.
+     */
+    protected function getRedis(): RedisStore
Evidence
The deleted test lines (old ~249-259 in the patch) asserted a single SCAN call. The current
replacement tests at tests/Integration/Cache/Redis/RedisStoreTest.php[400-449] contain no scan-count
assertion. A search for getScanCallCount across tests/ finds it only in unrelated operation tests
(PruneTest, FlushByPatternTest, SafeScanTest). This contradicts the PR's claim that it consolidates
coverage 'without losing distinct assertions'.

tests/Integration/Cache/Redis/RedisStoreTest.php[400-449]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The stale-tag flush test that checked SCAN stops after cursor 0 (one scan call) was removed with no equivalent.
## Fix Focus Areas
- tests/Integration/Cache/Redis/RedisStoreTest.php[400-449]
- tests/Cache/CacheRedisStoreTest.php[30-43]
## Recommended Fix
Add a test for `flushStaleTags()` that checks scan termination. Either keep a small unit test that uses a fake client exposing `getScanCallCount()` and assert it equals 1 when the first cursor returns 0, or count SCAN commands in the integration test.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


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

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

6 issues found across 225 files

Confidence score: 3/5

  • AuthenticateSessionTest.php leaves a redirect callback installed, so later session tests can inherit the wrong redirect instead of checking the default. Clear the callback between tests.
  • MailResendTransportTest.php uses a Client double without the __get accessor that ResendTransport uses, so the test can fail when it accesses the email service. Add the accessor or use a suitable client double.
  • DatabaseConcernsPreventsCircularRecursionTest.php passes 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.php changes 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

Comment thread tests/Queue/QueueRetryCommandTest.php Resolved
Comment thread tests/Mail/MailResendTransportTest.php Resolved
Comment thread tests/Database/MigratorTest.php Resolved
Comment thread AGENTS.md Resolved
@greptile-apps

greptile-apps Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no new actionable issues were established.

Summary

Adopts Double across core framework tests while retaining Mockery-backed framework helpers and existing PHPUnit doubles.

  • Framework tests use verified Double collaborators instead of direct Mockery doubles.
  • Database, queue, Redis, and session tests exercise real framework paths.
  • SES v2 sends raw sender headers without the v1-only Source field.
  • Retry commands keep queue names and job IDs equal to 0.
  • The View contract includes the rendering data response assertions read.

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.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying hypervel-org with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5568bb0
Status:🚫  Build failed.

View logs

@binaryfire

Copy link
Copy Markdown
Member Author

The stale-tag scan-termination coverage remains in the owning operation tests. RedisStore::flushStaleTags() delegates to AllTag\Prune::execute(); PruneTest::testPruneUsesCorrectScanPattern checks one SCAN when the cursor is zero, and testPruneProcessesDuplicateScanResults checks two pages. The integration case also exercises the real operation to completion. No additional counting harness is needed.

@binaryfire
binaryfire merged commit fc6fb57 into 0.4 Nov 16, 2026
51 of 52 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