-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix error when saving contacts without points available #14714
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
Fix error when saving contacts without points available #14714
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 5.2 #14714 +/- ##
============================================
- Coverage 63.72% 63.72% -0.01%
- Complexity 34687 34688 +1
============================================
Files 2274 2274
Lines 103777 103778 +1
============================================
Hits 66132 66132
- Misses 37645 37646 +1
🚀 New features to boost your workflow:
|
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.
From the code perspective it makes sense to stop here if the $availablePoints
are empty. But knowing how to reproduce this state and having a test covering it would be really great.
@npracht I have no idea how to reproduce this bug or how to test. Please provide extended instructions if you'd like us to merge? Plus see comment regarding test coverage. Thanks! |
…eturn functionality in the PointModel. Let me break down what the tests verify: 1. `testTriggerActionReturnsEarlyWhenNoAvailablePoints`: - Checks that when no points are available for a given type - The method returns early - The IP lookup helper is never called 2. `testTriggerActionContinuesWhenPointsAreAvailable`: - Checks that when points are available for a given type - The method continues execution - The IP lookup helper is called The test uses mocking to isolate the behavior and verify the specific interactions. Recommendations: - The tests look comprehensive for the specific change - No additional files are needed at this point Would you like me to elaborate on any part of the test or discuss any specific aspects of the implementation?
@RCheesley I believe it creates anonymous leads when forms are submitted, but it was a long time ago, so I’m not sure. Just test If points working properly. |
@escopecz tests added |
…arnings in PointModelTest
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.
It would be better to use a functional test which actually fails when a bug happens and not when we refactor the internal code and have to refactor the unit test mocks along with it. I can see you got lost in implementing the mocked methods. A functional test is usually even faster way how to cover the code.
What should we check in functional tests? For example, there are already tests for the triggerAction method
|
The functional tests should configure the scenario that replicates the bug. I can't tell as the steps to test are missing. |
@escopecz it's very specific case with our private plugin. |
…f-points-log-exists
- Added testPointActionEarlyReturnWhenNoPointsAvailable() method - Tests that PointModel::triggerAction() returns early when no published point actions exist - Verifies points remain unchanged (0) when no point actions are configured - Covers the optimization added in the PR fix
|
@escopecz can you consider approve it? we need get rid similar PRs like this. It can break nothing |
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.
The code changes look fine to me. Can be merged before the last bug fix release from my point of view
Description
Save Lead entity just If points log exist to avoid error.
📋 Steps to test this PR: