Skip to content

Conversation

@IonBazan
Copy link
Member

@IonBazan IonBazan commented Dec 6, 2025

Q A
Type improvement
BC Break no
Fixed issues -

Summary

Updates tests to use PHPUnit 12 features and avoids deprecations:

  • Creating a Mock with no expectations (Stub should be used)
  • isType('array') -> isArray()
  • Providing extra arguments to a test via data provider

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the test suite to use PHPUnit 12, addressing deprecations and adopting new best practices introduced in PHPUnit 12.

  • Updates PHPUnit dependency from ^10.5.58|^11.5.43 to ^12.5.1
  • Migrates deprecated isType('array') assertions to isArray()
  • Converts mocks without expectations to stubs using createStub()
  • Updates type hint syntax to use intersection types (Type&MockObject)
  • Fixes data provider parameter structure to avoid providing unused arguments

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
composer.json Updates PHPUnit requirement to version 12.5.1
tests/Tests/UnitOfWorkTest.php Replaces deprecated isType('array') with isArray()
tests/Tests/SchemaManagerTest.php Converts mocks to stubs where no expectations are set, updates type hints to intersection syntax, adds atLeast(0) expectations to maintain mock behavior
tests/Tests/QueryTest.php Converts cursor mocks to stubs, updates type hints, removes unused imports
tests/Tests/Query/BuilderTest.php Consolidates data provider parameters for near() and nearSphere() methods, updates type hints
tests/Tests/Proxy/Factory/ProxyFactoryTest.php Updates type hint syntax to intersection type
tests/Tests/Functional/SplObjectHashCollisionsTest.php Adds int $leftover parameter to test method signature to match data provider
tests/Tests/Functional/DocumentPersisterTest.php Replaces deprecated isType('array') with isArray() across multiple test methods
tests/Tests/Events/OnClassMetadataNotFoundEventArgsTest.php Converts mock to stub where no expectations are needed
tests/Tests/Aggregation/AggregationTestTrait.php Updates type hints to intersection syntax

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +500 to +501
'near()' => ['near', [[1, 2], null, 5, 10]],
'nearSphere()' => ['nearSphere', [[1, 2], null, 5, 10]],
Copy link
Member Author

@IonBazan IonBazan Dec 6, 2025

Choose a reason for hiding this comment

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

This caused extra arguments to be provided to the test. It only accepts 2 arguments and the second one must be array. I believe it was causing unexpected results.

Copy link
Member

Choose a reason for hiding this comment

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

Can you backport this fix?

Comment on lines +500 to +501
'near()' => ['near', [[1, 2], null, 5, 10]],
'nearSphere()' => ['nearSphere', [[1, 2], null, 5, 10]],
Copy link
Member

Choose a reason for hiding this comment

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

Can you backport this fix?

@GromNaN GromNaN merged commit 310f9bc into doctrine:3.0.x Dec 6, 2025
15 checks passed
@GromNaN
Copy link
Member

GromNaN commented Dec 6, 2025

Thank you @IonBazan

@IonBazan IonBazan deleted the phpunit-12 branch December 7, 2025 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants