Fix unit test to not rely on hacking the DB to have ids for price set… #11652
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
Fix test to be more robust regarding set up & tear down
Before
Test relies on some pretty hacky DB manipulation
After
Test works on 'neutral' DB state
Technical Details
I added 'another' function for getting the line item array since none of the ones that existed seemed to be 'neutral' / logical & I feel we need to start deprecating them in favour of something more thought through. The code for building line items & processing them is notably hard to read & fragile (perhaps not surprising as much of it was done in 4.2)
I would argue that if we know the field & the submitted value (e.g price_4 => 6) we have all the information we need to build the params. If the calling function is relying on a default priceset then this call could be wrapped in something that reformats to the standard price set params. Aim to replace getLineItemArray - or at least the first half of it with this function
Comments
Removes blocker to test config changes in #11646