Follow up on #12611 - adding in three data-integrity assertions. #12629
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
#12611 merged in three assertions (commented out as they failed by $5 for unknown reasons at that time). I committed to getting to the bottom of why the GUI produced $5 different results compared to the phpunit test.
Before
Assertions would fail when commented in
After
Assertions now pass when commented in
Technical Details
I ran the entire class CRM_Member_Form_MembershipTest - and all tests pass. Letting Jenkins have a go at it next.
After spending most of today in CRM_Contribute_Form_Contribution submit - it finally dawned on me that the phpunit tests simulate an admin created Price Set -> so is_quick_config must be set to => 0. If it is not set to => 0 then transact essentially creates the civicrm_line_item from the Contribution data and that's off by $5 (= tax_amount).
Todo next: I will commit to try add a similar phpunit test for Edits on Participant registrations with LineItems.
Todo longer term: CRM_Contribute_Form_Contribution submit is a very scary place... having more tests like the ones added here - may allow some much needed refactoring in future.