-
-
Notifications
You must be signed in to change notification settings - Fork 515
[3.x] Use PHPUnit 12 #2961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[3.x] Use PHPUnit 12 #2961
Conversation
There was a problem hiding this 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.43to^12.5.1 - Migrates deprecated
isType('array')assertions toisArray() - 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.
| 'near()' => ['near', [[1, 2], null, 5, 10]], | ||
| 'nearSphere()' => ['nearSphere', [[1, 2], null, 5, 10]], |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
| 'near()' => ['near', [[1, 2], null, 5, 10]], | ||
| 'nearSphere()' => ['nearSphere', [[1, 2], null, 5, 10]], |
There was a problem hiding this comment.
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?
|
Thank you @IonBazan |
Summary
Updates tests to use PHPUnit 12 features and avoids deprecations:
isType('array')->isArray()