Skip to content
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 unit test to not rely on hacking the DB to have ids for price set… #11652

Merged
merged 1 commit into from
Feb 8, 2018

Conversation

eileenmcnaughton
Copy link
Contributor

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

@monishdeb
Copy link
Member

Nice work :) merging now

@monishdeb monishdeb merged commit afe4b6b into civicrm:master Feb 8, 2018
@monishdeb monishdeb deleted the hack_test branch February 8, 2018 03:24
@eileenmcnaughton
Copy link
Contributor Author

we'll just have to keep working on line item function rationalisation - my thinking is write something better & migrate to it - but you might have other ideas

@mlutfy mlutfy added this to the 4.7.31 milestone Feb 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants