CRMTraits_Financial_PriceSetTrait
Trait PriceSetTrait
Trait for working with Price Sets in tests
Table of Contents
Methods
- createContributionWithTwoLineItemsAgainstPriceSet() : void
- Create a contribution with 2 line items.
- createMembershipPriceSet() : void
- Create a non-quick-config price set with all memberships in it.
- getPriceFieldFormLabel() : string
- Get the label for the form price field - eg price_6
- getPriceFieldID() : int
- Get the created price field id.
- getPriceFieldLabelForContributionPage() : string
- Get the appropriate price field label for the given contribution page.
- getPriceSetID() : int
- Get the created price set id.
- setUpMembershipBlockPriceSet() : void
- Set up a membership block (quick config) price set.
Methods
createContributionWithTwoLineItemsAgainstPriceSet()
Create a contribution with 2 line items.
protected
createContributionWithTwoLineItemsAgainstPriceSet(mixed $params[, array<string|int, mixed> $lineItemFinancialTypes = [] ][, string $identifier = 'Donation' ]) : void
This also involves creating t
Parameters
- $params : mixed
- $lineItemFinancialTypes : array<string|int, mixed> = []
-
Financial Types, if an override is intended.
- $identifier : string = 'Donation'
-
Name to identify price set.
createMembershipPriceSet()
Create a non-quick-config price set with all memberships in it.
protected
createMembershipPriceSet() : void
The price field is of type checkbox and each price-option corresponds to a membership type
getPriceFieldFormLabel()
Get the label for the form price field - eg price_6
protected
getPriceFieldFormLabel(string $key) : string
Parameters
- $key : string
Return values
stringgetPriceFieldID()
Get the created price field id.
protected
getPriceFieldID([string $key = 'membership' ]) : int
Parameters
- $key : string = 'membership'
Return values
intgetPriceFieldLabelForContributionPage()
Get the appropriate price field label for the given contribution page.
protected
getPriceFieldLabelForContributionPage(int $contributionPageID) : string
This works for quick config pages with only one option.
Parameters
- $contributionPageID : int
Tags
Return values
stringgetPriceSetID()
Get the created price set id.
protected
getPriceSetID([string $key = 'membership' ]) : int
Parameters
- $key : string = 'membership'
Return values
intsetUpMembershipBlockPriceSet()
Set up a membership block (quick config) price set.
protected
setUpMembershipBlockPriceSet() : void
This creates a price set consistent with a contribution page with non-quick config membership and an optional additional contribution non-membership amount.