Add tests to kill escaped mutants (#529)#545
Add tests to kill escaped mutants (#529)#545dbuhonov wants to merge 68 commits intoyiisoft:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #545 +/- ##
=============================================
- Coverage 100.00% 99.87% -0.13%
- Complexity 654 656 +2
=============================================
Files 43 43
Lines 1628 1612 -16
=============================================
- Hits 1628 1610 -18
- Misses 0 2 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
ec926d0 to
27f1743
Compare
… in EventsTraitTest.
…multiple test files.
…nd `RelationPopulator`
… behavior in RelationPopulator
There was a problem hiding this comment.
Pull request overview
This PR adds/extends PHPUnit coverage across ActiveRecord, ActiveQuery, events, array access/arrayable behavior, and several internal helpers to improve mutation score (Issue #529) by exercising previously untested branches and edge-cases.
Changes:
- Added many new tests around relation population/reset, upsert/link/unlink edge cases, event dispatching, and query/join/via behaviors.
- Introduced multiple new test stub ActiveRecord/ActiveQuery classes to support targeted scenarios (deep via relations, composite PKs, overridden internals, etc.).
- Updated Infection configuration with explicit mutator ignores for specific survivors.
Reviewed changes
Copilot reviewed 27 out of 27 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Stubs/MagicActiveRecord/CategoryWithNameRelationArrayAccess.php | New stub for ArrayAccess + magic relation name collision scenarios. |
| tests/Stubs/ActiveRecord/OrderWithCustomerProfileViaCustomerRelation.php | New stub to exercise nested “via” relation dependency handling. |
| tests/Stubs/ActiveRecord/OrderItemWithDeepViaProfile.php | New stub to cover deep via chain relation population. |
| tests/Stubs/ActiveRecord/OrderItemWithConstructor.php | Docblock fix for stub class name. |
| tests/Stubs/ActiveRecord/EmployeeWithPrototypeDossierRelation.php | New stub for prototype-cloned relation target and stricter PK checks. |
| tests/Stubs/ActiveRecord/CustomerWithUpdateInternalOverride.php | New stub to test overridable updateInternal(). |
| tests/Stubs/ActiveRecord/CustomerWithRefreshInternalOverride.php | New stub to test overridable refreshInternal(). |
| tests/Stubs/ActiveRecord/CustomerWithOverriddenRelationQuery.php | New stub to test overridable relation query creation. |
| tests/Stubs/ActiveRecord/CustomerWithDeleteInternalOverride.php | New stub to test overridable deleteInternal(). |
| tests/Stubs/ActiveRecord/CustomerSetValueOnUpdateUpsert.php | New stub for SetValueOnUpdate behavior during upsert. |
| tests/Stubs/ActiveRecord/CustomerEventsModel.php | New stub enabling EventsTrait on Customer. |
| tests/Stubs/ActiveRecord/CompositePrimaryKeyDossier.php | New stub for composite PK relation/linking scenarios. |
| tests/Stubs/ActiveQuery/SingleModelArrayActiveQuery.php | New stub to ensure one() path doesn’t fall back to all(). |
| tests/Stubs/ActiveQuery/OverriddenPrimaryTableNameActiveQuery.php | New stub to cover overriding primary table resolution. |
| tests/Stubs/ActiveQuery/OverriddenCreateModelsActiveQuery.php | New stub to cover overriding model creation from rows. |
| tests/Stubs/ActiveQuery/MissingLinkValuesActiveQuery.php | New stub for missing link values during relation population. |
| tests/Stubs/ActiveQuery/CreateModelsExceptionOnEmptyRowsActiveQuery.php | New stub ensuring empty populate doesn’t call createModels(). |
| tests/Stubs/ActiveQuery/AlternativeActiveQuery.php | New stub for alternate ActiveQuery implementation. |
| tests/RepositoryTraitTest.php | Added coverage for find() behavior with null condition/params handling. |
| tests/MagicActiveRecordTest.php | Added tests for save/update behavior and property accessor edge-cases. |
| tests/EventsTraitTest.php | Expanded event dispatch/handler behavior coverage (after-events, soft delete, defaults, etc.). |
| tests/Driver/Pgsql/ActiveQueryTest.php | Added PG-specific assertions for ModelRelationFilter conditions. |
| tests/ArrayableTraitTest.php | Added extraFields() coverage. |
| tests/ArrayAccessTraitTest.php | Expanded ArrayAccess tests for properties vs relations and magic properties. |
| tests/ActiveRecordTest.php | Added extensive relation reset/dependency, PK error message, upsert/link/unlink/counters, override hooks tests. |
| tests/ActiveQueryTest.php | Added extensive coverage for populate/dedup, joinWith validation, viaTable callable, relation population internals. |
| infection.json.dist | Added explicit mutator ignore configuration for remaining survivors. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…arity and coverage.
|
Up review pls |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…esFromPropertyNames
There was a problem hiding this comment.
These changes should be moved in separate PR if they still actual.
Covered Code MSI: 98%