Documentation

api_v3_ContributionTest extends CiviUnitTestCase uses CRMTraits_Profile_ProfileTrait, CRMTraits_Custom_CustomDataTrait, CRMTraits_Financial_OrderTrait, CRMTraits_Financial_TaxTrait, CRMTraits_Financial_PriceSetTrait, FormTrait, CRM_Core_Payment_AuthorizeNetTrait

Test APIv3 civicrm_contribute_* functions

Tags
subpackage

API_Contribution

group

headless

Table of Contents

Properties

$apiversion  : int
API version to use for any api calls.
$hookClass  : CRM_Utils_Hook_UnitTests
Class used for hooks during tests.
$setupIDs  : array<string|int, mixed>
Array of IDs created during test setup routine.
$_apiversion  : int
API version in use.
$_ids  : mixed
$_params  : array<string|int, mixed>
$_tablesToTruncate  : array<string|int, mixed>
Track tables we have modified during a test.
$entity  : mixed
$financialTypeID  : mixed
$formController  : CRM_Event_Controller_Registration
Form controller being used.
$ids  : array<string|int, mixed>
Array of IDs created to support the test.
$individualID  : mixed
$isGetSafe  : bool
Has the test class been verified as 'getsafe'.
$isLocationTypesOnPostAssert  : bool
Should location types be checked to ensure primary addresses are correctly assigned after each test.
$isRecur  : bool
Is this a recurring transaction.
$isValidateFinancialsOnPostAssert  : bool
Should financials be checked after the test but before tear down.
$mut  : CiviMailUtils
$origExtensionSystem  : CRM_Extension_System
$originalSettings  : array<string|int, mixed>
$pageParams  : mixed
$processor  : CRM_Core_Payment_AuthorizeNet
$tempDirs  : array<string|int, mixed>
$errorHandlerAtStartOfTest  : mixed
$form  : FormWrapper
$frozenTime  : CRM_Utils_AutoClean
$page  : PageWrapper
$tx  : CRM_Core_Transaction

Methods

__construct()  : mixed
Constructor.
_addPaymentInstrument()  : mixed
_checkFinancialItem()  : void
_checkFinancialRecords()  : mixed
_checkFinancialTrxn()  : void
Check financial transaction.
_getFinancialItemAmount()  : null|string
_getFinancialTrxnAmount()  : null|string
Get financial transaction amount.
activityCreate()  : array<string|int, mixed>
Create Activity.
addDiscountPriceSet()  : void
Add a discount price set to the given event.
assertAPIArrayComparison()  : mixed
Check that api returned 'is_error' => 1 else provide full message
assertAPIDeleted()  : mixed
Check that a deleted item has been deleted.
assertAPIFailure()  : void
Check that api returned 'is_error' => 1.
assertAPISuccess()  : mixed
Check that api returned 'is_error' => 0.
assertApproxEquals()  : mixed
Assert that two numbers are approximately equal, give or take some $tolerance.
assertArrayKeyExists()  : mixed
assertArrayValueNotNull()  : mixed
assertArrayValuesEqual()  : mixed
Assert the 2 arrays have the same values.
assertAttributesEquals()  : mixed
Assert attributes are equal.
assertDBCompareValue()  : mixed
Compare a single column value in a retrieved DB record to an expected value.
assertDBCompareValues()  : mixed
Compare all values in a single retrieved DB record to an array of expected values.
assertDBNotNull()  : null|string
Request a record from the DB by seachColumn+searchValue. Success if a record is found.
assertDBNull()  : mixed
Request a record from the DB by seachColumn+searchValue. Success if returnColumn value is NULL.
assertDBQuery()  : void
Assert that a SQL query returns a given value.
assertDBRowExist()  : mixed
Request a record from the DB by id. Success if row not found.
assertDBRowNotExist()  : mixed
Request a record from the DB by id. Success if row not found.
assertDBState()  : void
Generic function to compare expected values after an api call to retrieved.
assertLocationValidity()  : void
Validate that all location entities have exactly one primary.
assertTreeEquals()  : mixed
Assert that two array-trees are exactly equal.
assertType()  : mixed
batchCreate()  : int
Create a sample batch.
buildEnvironment()  : CiviEnvBuilder
Declare the environment that we wish to run in.
callAPIAndDocument()  : array<string|int, mixed>|int
callAPIFailure()  : array<string|int, mixed>|int
This function exists to wrap api functions.
callAPISuccess()  : array<string|int, mixed>|int
wrap api functions.
callAPISuccessGetCount()  : array<string|int, mixed>|int
This function exists to wrap api getValue function & check the result so we can ensure they succeed & throw exceptions without littering the test with checks There is a type check in this
callAPISuccessGetSingle()  : array<string|int, mixed>|int
This function exists to wrap api getsingle function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks
callAPISuccessGetValue()  : array<string|int, mixed>|int
This function wraps the getValue api and checks the result.
campaignCreate()  : int
caseCreate()  : void
checkArrayEquals()  : void
Get formatted values in the actual and expected result.
checkCreditCardDetails()  : void
Check credit card details in sent mail via API
checkFinancialTrxnPaymentInstrumentChange()  : void
Check correct financial transaction entries were created for the change in payment instrument.
checkReceiptDetails()  : void
Check receipt details in sent mail via API
civicrm_api()  : array<string|int, mixed>|int
A stub for the API interface. This can be overriden by subclasses to change how the API is called.
civicrmPostContributionCustom()  : void
Implement post hook.
CiviUnitTestCase_fatalErrorHandler()  : mixed
cleanTempDirs()  : mixed
contactDelete()  : void
Delete contact, ensuring it is not the domain contact
contactMembershipCreate()  : int
Create membership.
contributionCreate()  : int
Create contribution.
contributionDelete()  : array<string|int, mixed>|int
Delete contribution.
contributionGetnCheck()  : void
This function does a GET & compares the result against the $params.
contributionPageCreate()  : array<string|int, mixed>
Create contribution page.
contributionStatusProvider()  : array<string|int, mixed>
Dataprovider provides contribution status as [optionvalue=>contribution_status_name] FIXME: buildOptions seems to die in CRM_Core_Config::_construct when in test mode.
createCase()  : CRM_Case_BAO_Case
Create and return a case object for the given Client ID.
createCustomFieldsOfAllTypes()  : array<string|int, mixed>
createCustomGroup()  : int
Create a custom group.
createCustomGroupWithFieldOfType()  : void
Create a custom group with a single field.
createCustomGroupWithFieldsOfAllTypes()  : void
Create a custom group with fields of multiple types.
createDomainContacts()  : void
Create default domain contacts for the two domains added during test class.
createExternalAPI()  : ExternalBatch
Create a batch of external API calls which can be executed concurrently.
createFinancialTaxAccount()  : void
Create the financial account for tax.
createFinancialTypeWithSalesTax()  : void
Create a financial type with related sales tax config.
createLocalizedContributionDataProvider()  : array<string|int, mixed>
createLoggedInUser()  : int
Emulate a logged in user since certain functions use that.
createMailing()  : int
Helper function to create new mailing.
createPendingParticipantContribution()  : int
Create a pending contribution & linked pending participant record (along with an event).
createPendingPledgeContribution()  : int
Create a pending contribution & linked pending pledge record.
createPriceSetWithPage()  : void
Create price set with contribution test for test setup.
createRepeatMembershipOrder()  : void
Create a pending membership from a recurring order.
createTempDir()  : string
Generate a temporary folder.
customDirectories()  : mixed
Helper to enable/disable custom directory support
customFieldCreate()  : array<string|int, mixed>
Create custom field.
customFieldDelete()  : array<string|int, mixed>|int
Delete custom field.
customFieldOptionValueCreate()  : array<string|int, mixed>|int
Create custom field with Option Values.
customGroupCreate()  : array<string|int, mixed>
Create custom group.
CustomGroupCreateByParams()  : array<string|int, mixed>|int
Existing function doesn't allow params to be over-ridden so need a new one this one allows you to only pass in the params you want to change
customGroupDelete()  : array<string|int, mixed>|int
Delete custom group.
CustomGroupMultipleCreateByParams()  : array<string|int, mixed>|int
Create custom group with multi fields.
CustomGroupMultipleCreateWithFields()  : array<string|int, mixed>
Create custom group with multi fields.
deletedAddedPaymentInstrument()  : void
deleteMailing()  : mixed
Helper function to delete mailing.
disableMultilingual()  : void
dummyProcessorCreate()  : CRM_Core_Payment_Dummy
Create Payment Processor.
enableCiviCampaign()  : void
Enable CiviCampaign Component.
enableMultilingual()  : void
Enable multilingual.
entityCustomGroupWithSingleFieldCreate()  : array<string|int, mixed>
Create a custom group with a single text custom field. See participant:testCreateWithCustom for how to use this
entityCustomGroupWithSingleStringMultiSelectFieldCreate()  : array<string|int, mixed>
Create a custom group with a single text custom field, multi-select widget, with a variety of option values including upper and lower case.
entityTagAdd()  : true
Add entity(s) to the tag
eventCreate()  : array<string|int, mixed>
Create an Event.
eventDelete()  : array<string|int, mixed>|int
Delete event.
financialAccountDelete()  : mixed
getAndCheck()  : void
getBooleanDataProvider()  : array<string|int, mixed>
Get the boolean options as a provider.
getCustomGroupTable()  : string
Get the table_name for the specified custom group.
getExpectedRecurResponse()  : string
Get a successful response to setting up a recurring.
getExpectedSinglePaymentRequest()  : string
Get the expected request from Authorize.net.
getExpectedSinglePaymentResponse()  : string
Get the expected response from Authorize.net.
getFieldsValuesByType()  : array<string|int, mixed>
Get default field values for the type of field.
getFinancialTypeID()  : int
Return financial type id on basis of name
getFormObject()  : CRM_Core_Form|CRM_Event_Form_Registration_Register
Instantiate form object.
getLoggedInUser()  : int|null
Get the logged in user record.
getRepeatTransactionNextSchedData()  : array<string|int, mixed>
Get dates for testing.
getScheduledDateData()  : array<string|int, mixed>
Get dates for testing.
getSearchFormObject()  : CRM_Core_Form
Instantiate form object.
getTestForm()  : FormWrapper
getTestPage()  : PageWrapper
getThousandSeparators()  : array<string|int, mixed>
Get possible thousand separators.
groupContactCreate()  : int
Function to add a Group.
groupCreate()  : int
Add a Group.
groupDelete()  : mixed
Delete a Group.
householdCreate()  : int
Generic function to create Household, to be used in test cases
individualCreate()  : int
Generic function to create Individual, to be used in test cases
loadAllFixtures()  : void
Read everything from the datasets directory and insert into the db.
locationAdd()  : int
Add a Location.
locationTypeCreate()  : int
Add a Location Type.
locationTypeDelete()  : void
Delete a Location Type.
mappingCreate()  : CRM_Core_DAO_Mapping
Add a Mapping.
mappingDelete()  : void
Delete a Mapping
membershipDelete()  : mixed
membershipRenewalDate()  : mixed
membershipStatusCreate()  : int
membershipStatusDelete()  : void
Delete the given membership status, deleting any memberships of the status first.
membershipTypeCreate()  : int
membershipTypeDelete()  : mixed
Delete Membership Type.
offsetDefaultPriceSet()  : mixed
Alter default price set so that the field numbers are not all 1 (hiding errors)
onPost()  : mixed
An implementation of hook_civicrm_post used with all our test cases.
organizationCreate()  : int
Generic function to create Organisation, to be used in test cases
participantCreate()  : int
Create Participant.
participantDelete()  : array<string|int, mixed>|int
Delete participant.
participantPaymentCreate()  : int
Create participant payment.
participantPaymentDelete()  : mixed
Delete participant payment.
paymentProcessorAuthorizeNetCreate()  : int
Create test Authorize.net instance.
paymentProcessorCreate()  : int
Create an instance of the paypal processor.
paymentProcessorTypeCreate()  : int
pledgeCreate()  : int
Create pledge.
pledgeDelete()  : void
Delete pledge.
processorCreate()  : int
Create Payment Processor.
quickCleanup()  : void
Quick clean by emptying tables created for the test.
quickCleanUpFinancialEntities()  : void
Clean up financial entities after financial tests (so we remember to get all the tables :-))
relationshipTypeCreate()  : int
Create a relationship type.
relationshipTypeDelete()  : mixed
Delete Relatinship Type.
restoreDefaultPriceSetConfig()  : void
Reset the price set config so results exist.
restoreMembershipTypes()  : void
Recreate default membership types.
retrieveEntityFinancialTrxn()  : array<string|int, mixed>
Retrieve entity financial trxn details.
runApi4Legacy()  : array<string|int, mixed>|int
Emulate v3 syntax so we can run api3 tests on v4
sampleContact()  : array<string|int, mixed>
Helper function for getting sample contact properties.
selectWhereClauseHook()  : void
setExtensionSystem()  : mixed
Temporarily replace the singleton extension with a different one.
setMockSettingsMetaData()  : void
Temporarily alter the settings-metadata to add a mock setting.
setUp()  : void
Setup function.
setupACL()  : void
Set up an acl allowing contact to see 2 specified groups - $this->_permissionedGroup & $this->_permissionedDisabledGroup
setUpBeforeClass()  : void
setupForSmsTests()  : mixed
Setup or clean up SMS tests
setupMembershipRecurringPaymentProcessorTransaction()  : void
We don't have a good way to set up a recurring contribution with a membership so let's just do one then alter it
setUpPendingContribution()  : void
Set up a pending transaction with a specific price field id.
setupRecurringPaymentProcessorTransaction()  : void
Set up initial recurring payment allowing subsequent IPN payments.
smartGroupCreate()  : int
Create a smart group.
tagCreate()  : array<string|int, mixed>
Create Tag.
tagDelete()  : int
Delete Tag.
tearDown()  : void
Clean up after each test.
testBillingAddress()  : void
Test to check whether contact billing address is used when no contribution address
testCardTypeAndPanTruncation()  : void
function to test card_type and pan truncation.
testCheckTaxAmount()  : void
CRM-19126 Add test to verify when complete transaction is called tax amount is not changed.
testCleanMoney()  : void
Test the "clean money" functionality.
testCompleteTransaction()  : void
Test completing a transaction via the API.
testCompleteTransactionContributionPageFromAddress()  : void
Complete the transaction using the template with all the possible.
testCompleteTransactionEuro()  : void
Test completing a transaction via the API with a non-USD transaction.
testCompleteTransactionFeeAmount()  : void
Test completing a transaction via the API.
testCompleteTransactionForRecurring()  : void
Test that $is_recur is assigned to the receipt.
testCompleteTransactionMembershipPriceSet()  : void
Test membership is renewed when transaction completed.
testCompleteTransactionMembershipPriceSetTwoTerms()  : void
Test membership is renewed for 2 terms when transaction completed based on the line item having 2 terms as qty.
testCompleteTransactionNetAmountOK()  : void
Test completing a transaction does not 'mess' with net amount (CRM-15960).
testCompleteTransactionSetStatusToInProgress()  : void
Test completing first transaction in a recurring series.
testCompleteTransactionUpdatePledgePayment()  : void
Test completing a pledge with the completeTransaction api.. Note that we are creating a logged in user because email goes out from that person.
testCompleteTransactionWithEmailReceiptInput()  : void
CRM-1960 - Test to ensure that completetransaction respects the is_email_receipt setting
testCompleteTransactionWithEmailReceiptInputTrue()  : void
CRM-19710 - Test to ensure that completetransaction respects the input for is_email_receipt setting.
testCompleteTransactionWithParticipantRecord()  : void
Test completing a transaction with an event via the API.
testCompleteTransactionWithReceiptDateSet()  : void
CRM-14151 - Test completing a transaction via the API.
testCompleteTransactionWithTestTemplate()  : void
Complete the transaction using the template with all the possible.
testContributionGetUnique()  : void
Test getunique api call for Contribution entity
testContributionOrder()  : void
Test Contribution with Order api.
testCreateBAODefaults()  : void
Test that BAO defaults work.
testCreateCheckContribution()  : void
Test Creating a check contribution with original check_number field
testCreateContributionChainedLineItems()  : void
Test checks that passing in line items suppresses the create mechanism.
testCreateContributionNoLineItems()  : void
Test creating a contribution without skipLineItems.
testCreateContributionNullOutThankyouDate()  : void
Create test with unique field name on source.
testCreateContributionOffline()  : void
testCreateContributionOnline()  : void
Function tests that additional financial records are created when online contribution is created.
testCreateContributionPayLaterOnline()  : void
Tests that additional financial records are created.
testCreateContributionPendingOnline()  : void
Function tests that additional financial records are created for online contribution with pending option.
testCreateContributionSource()  : void
Create test with unique field name on source.
testCreateContributionSourceInvalidContact()  : void
Create test with unique field name on source.
testCreateContributionWithFee()  : void
Function tests that additional financial records are created when fee amount is recorded.
testCreateContributionWithHonoreeContact()  : void
Test creating contribution with Soft Credit by passing in honor_contact_id.
testCreateContributionWithNote()  : void
Test note created correctly.
testCreateContributionWithNoteUniqueNameAliases()  : void
testCreateContributionWithPaymentInstrument()  : void
Test create with valid payment instrument.
testCreateContributionWithSoftCredit()  : void
This is the test for creating soft credits.
testCreateContributionWithSoftCreditDefaults()  : void
testCreateDefaultNow()  : void
Create test with unique field name on source.
testCreateEmptyContributionIDUseDonation()  : void
Create an contribution_id=FALSE and financial_type_id=Donation.
testCreateGetFieldsWithCustom()  : void
Check with complete array + custom field.
testCreateLocalizedContribution()  : void
testCreateUpdateChargebackContributionCustomAccount()  : void
Refund a contribution for a financial type with a contra account.
testCreateUpdateChargebackContributionDefaultAccount()  : void
Refund a contribution for a financial type with a contra account.
testCreateUpdateContribution()  : void
Test Updating a Contribution.
testCreateUpdateContributionCancelPending()  : void
Function tests that financial records are added when Pending Contribution is Canceled.
testCreateUpdateContributionChangeFinancialType()  : void
Function tests that financial records are added when Financial Type is Changed.
testCreateUpdateContributionChangeTotal()  : void
Function tests that line items, financial records are updated when contribution amount is changed.
testCreateUpdateContributionInValidStatusChange()  : void
Function tests invalid contribution status change.
testCreateUpdateContributionPayLater()  : void
Function tests that line items, financial records are updated when pay later contribution is received.
testCreateUpdateContributionPaymentInstrument()  : void
Function tests that financial records are updated when Payment Instrument is changed.
testCreateUpdateContributionRefund()  : void
Function tests that financial records are added when Contribution is Refunded.
testCreateUpdateContributionRefundRefundAndTrxnIDPassedIn()  : void
Function tests that trxn_id is set when passed in.
testCreateUpdateContributionRefundRefundNullTrxnIDPassedIn()  : void
Function tests that refund_trxn_id is set when passed in empty.
testCreateUpdateContributionRefundTrxnIDPassedIn()  : void
Function tests that trxn_id is set when passed in.
testCreateUpdateContributionWithFeeAmountChangeFinancialType()  : void
Function tets that financial records are correctly added when financial type is changed
testCreateUpdateNegativeContributionPaymentInstrument()  : void
Function tests that financial records are updated when Payment Instrument is changed when amount is negative.
testCreateUpdateRefundContributionConfiguredContraAccount()  : void
Refund a contribution for a financial type with a contra account.
testCreateUpdateWithoutChangingPendingStatus()  : void
Test that update does not change status id CRM-15105.
testCustomValueOptionLabelTest()  : void
Test that passing in label for an option value linked to a custom field works
testDeleteChainedGetSingle()  : void
Test that getsingle can be chained with delete.
testDeleteContribution()  : void
testDeleteEmptyParamsContribution()  : void
Attempt (but fail) to delete a contribution without parameters.
testDeleteWrongParamContribution()  : void
testFilterCancelReason()  : void
Test cancel reason works as a filter.
testGetContribution()  : void
Test Get.
testGetContributionByInvoice()  : void
CRM-16227 introduces invoice_id as a parameter.
testGetContributionByPaymentInstrument()  : void
testGetContributionByTotalAmount()  : void
Test retrieval by total_amount works.
testGetContributionLegacyBehaviour()  : void
We need to ensure previous tested api contract behaviour still works.
testGetContributionReturnFunctionality()  : void
Test the 'return' param works for all fields.
testGetCreditNoteCaseInsensitive()  : void
Check the credit note retrieval is case-insensitive.
testGetCurrencyOptions()  : void
testGetTestContribution()  : void
Test that test contributions can be retrieved.
testPayLater()  : void
Test to ensure mail is sent for pay later
testPaymentDontChangeReceiveDate()  : void
Make sure that recording a payment doesn't alter the receive_date of a pending contribution.
testPaymentVerifyPaymentInstrumentChange()  : void
Make sure that recording a payment with Different Payment Instrument update main contribution record payment instrument too. If multiple Payment Recorded, last payment record payment (when No more due) instrument set to main payment
testPendingToCompleteContribution()  : void
Test if renewal activity is created after changing Pending contribution to Completed via offline
testRepeatContributionWithTaxAmount()  : void
Test Repeat Transaction Contribution with Tax amount.
testRepeatTransaction()  : void
Test repeat contribution successfully creates line item.
testRepeatTransactionAcceptRecurID()  : void
Test repeat contribution accepts recur_id instead of original_contribution_id.
testRepeatTransactionAlteredAmount()  : void
CRM-16397 test that amount can be overidden for single line item contributions.
testRepeatTransactionIsTest()  : void
Test repeat contribution successfully creates is_test transaction.
testRepeatTransactionLineItems()  : void
Test repeat contribution successfully creates line items (plural).
testRepeatTransactionMembershipCreatePendingContribution()  : void
CRM-20008 Tests repeattransaction creates pending membership.
testRepeatTransactionMembershipRenewCompletedContribution()  : void
CRM-19945 Tests that Contribute.repeattransaction renews a membership when contribution status=Completed
testRepeatTransactionMembershipRenewContributionNotCompleted()  : void
CRM-19945 Tests that Contribute.repeattransaction DOES NOT renew a membership when contribution status=Failed
testRepeatTransactionPassedInCampaign()  : void
CRM-16397 test appropriate action if campaign has been passed in.
testRepeatTransactionPassedInFinancialType()  : void
Test financial_type_id override behaviour with a single line item.
testRepeatTransactionPassedInFinancialTypeTwoLineItems()  : void
Test financial_type_id override behaviour with a single line item.
testRepeatTransactionPassedInStatus()  : void
Test repeat contribution passed in status.
testRepeatTransactionPreviousContributionRefunded()  : void
Test repeat contribution accepts recur_id instead of original_contribution_id.
testRepeattransactionRenewMembershipOldMembership()  : void
This is one of those tests that locks in existing behaviour.
testRepeatTransactionTestRecurId()  : void
CRM-19873 Test repeattransaction if contribution_recur_id is a test.
testRepeatTransactionUpdatedCampaign()  : void
CRM-17718 campaign stored on contribution recur gets priority.
testRepeatTransactionUpdatedFinancialType()  : void
CRM-17718 test appropriate action if financial type has changed for single line items.
testRepeatTransactionUpdatedFinancialTypeAndNotEquals()  : void
CRM-20685 Repeattransaction produces incorrect Financial Type ID (in specific circumstance) - if number of lineItems = 1.
testRepeatTransactionUpdateNextSchedContributionDate()  : void
Test repeatTransaction with installments and next_sched_contribution_date
testRepeatTransactionWithCustomData()  : void
Test custom data is copied over from the template transaction.
testRepeatTransactionWithDifferenceCurrency()  : void
Test repeat contribution uses non default currency
testRepeatTransactionWithNonCreditCardDefault()  : void
Test repeat contribution uses the Payment Processor' payment_instrument setting.
testRepeatTransactionWithPledgePayment()  : void
Test repeating a pledge with the repeatTransaction api.
testSearch()  : void
Test civicrm_contribution_search. Success expected.
testSearchEmptyParams()  : void
Test civicrm_contribution_search with empty params.
testSendConfirmationPayLater()  : void
Test sending a mail via the API.
testSendconfirmationWithMembershipReceiptText()  : void
Test custom receipt_text for a membership with Contribution.sendconfirmation
testSendMail()  : void
Test sending a mail via the API.
testSendMailEvent()  : void
Test sending a mail via the API.
testSendMailWithAPISetFromDetails()  : void
Test sending a mail via the API.
testSendMailWithNoFromSetFallToDomain()  : void
Test sending a mail via the API.
testSendMailWithRepeatTransactionAPIFailtoDomain()  : void
Test sending a mail via the API.
testSendMailWithRepeatTransactionAPIFallToContributionPage()  : void
Test sending a mail via the API.
testSendMailWithRepeatTransactionAPIFalltoSystemFromNoDefaultFrom()  : void
Test sending a mail via the API.
testSetCustomDataInCreateAndHook()  : void
Test setting custom data in the create hook.
testUpdateContributionNetAmountVariants()  : void
Check that net_amount is updated when a contribution is updated.
uFFieldCreate()  : mixed
Create a UFField.
ufjoinCreate()  : int
Add a UF Join Entry.
unsetExtensionSystem()  : mixed
useMultilingual()  : CRM_Utils_AutoClean
Temporarily use multilingual.
useTransaction()  : mixed
Wrap the entire test case in a transaction.
versionThreeAndFour()  : array<string|int, mixed>
Get the api versions to test.
addLocationBlockToDomain()  : void
Add an address block to the current domain.
addOptionToCustomField()  : int
Add another option to the custom field.
addProfile()  : mixed
Add a profile to a contribution page.
addTaxAccountToFinancialType()  : CRM_Financial_DAO_EntityFinancialAccount
Add Sales Tax Account for the financial type.
assertAttachmentExistence()  : void
Assert the attachment exists.
assertLike()  : void
Assert 2 sql strings are the same, ignoring double spaces.
assertMailSentContainingHeaderString()  : void
Assert that the sent mail included the supplied string.
assertMailSentContainingHeaderStrings()  : void
Assert that the sent mail included the supplied strings.
assertMailSentContainingString()  : void
Assert that the sent mail included the supplied string.
assertMailSentContainingStrings()  : void
Assert that the sent mail included the supplied strings.
assertMailSentCount()  : void
Assert the right number of mails were sent.
assertMailSentNotContainingString()  : void
Assert that the sent mail included the supplied string.
assertMailSentNotContainingStrings()  : void
Assert that the sent mail included the supplied strings.
assertMailSentTo()  : void
Assert that the sent mail included the supplied strings.
assertOutputNotContainsString()  : void
Assert that the status set does not contain the given string.
assertPostConditions()  : void
CHeck that all tests that have created payments have created them with the right financial entities.
assertPrematureExit()  : void
assertRequestValid()  : void
Assert the request sent to Authorize.net contains the expected values.
assertTemplateVariable()  : void
assertValidationError()  : void
Assert that the sent mail included the supplied string.
basicCreateTest()  : void
Generic create test.
basicDeleteTest()  : void
Generic delete test.
captureOutputToCSV()  : Reader
Stop capturing browser output and return as a csv.
cleanUpAfterACLs()  : mixed
Reset after ACLs.
cleanupCustomGroups()  : void
Delete any existing custom data groups.
cleanUpSetUpIDs()  : mixed
Cleanup function for contents of $this->ids.
createAuthorizeNetProcessor()  : mixed
Create an AuthorizeNet processors with a configured mock handler.
createAutoCompleteCustomField()  : array<string|int, mixed>
Create custom select field.
createBooleanCustomField()  : array<string|int, mixed>
Create a custom text fields.
createContactReferenceCustomField()  : array<string|int, mixed>
Create a custom text fields.
createContributionAndMembershipOrder()  : void
Create an order with a contribution AND a membership line item.
createContributionWithTwoLineItemsAgainstPriceSet()  : void
Create a contribution with 2 line items.
createCountryCustomField()  : array<string|int, mixed>
Create a custom country fields.
createDateCustomField()  : array<string|int, mixed>
Create a custom field of type date.
createEventOrder()  : mixed
Create an order for an event.
createExtraneousContribution()  : mixed
Create an extraneous contribution to throw off any 'number one bugs'.
createFileCustomField()  : array<string|int, mixed>
Create a custom text fields.
createFinancialType()  : array<string|int, mixed>
Create Financial Type.
createInitialPaidMembership()  : void
Create a paid membership for renewal tests.
createIntCustomField()  : array<string|int, mixed>
Create a custom text fields.
createIntegerRadioCustomField()  : array<string|int, mixed>
Create a custom field of type radio with integer values.
createJoinedProfile()  : mixed
Add a profile to a contribution page.
createLinkCustomField()  : array<string|int, mixed>
Create a custom text fields.
createMembershipPriceSet()  : void
Create a non-quick-config price set with all memberships in it.
createMoneyTextCustomField()  : array<string|int, mixed>
Create a custom field of type money.
createMultiCountryCustomField()  : array<string|int, mixed>
Create a custom multi select country fields.
createMultipleMembershipOrder()  : mixed
Create an order with more than one membership.
createMultiStateCustomField()  : array<string|int, mixed>
Create a custom multi select state fields.
createPartiallyPaidParticipantOrder()  : array<string|int, mixed>
Add participant with contribution
createPriceSet()  : array<string|int, mixed>
Create price set that includes one price field with two option values.
createProfile()  : int
Create a profile.
createReceiptableContributionPage()  : array<string|int, mixed>
Create a Contribution Page with is_email_receipt = TRUE.
createRuleGroup()  : array<string|int, mixed>|int
createSelectCustomField()  : array<string|int, mixed>
Create custom select field.
createStateCustomField()  : array<string|int, mixed>
Create a custom state fields.
createStringCheckboxCustomField()  : array<string|int, mixed>
Create a custom field of type radio with integer values.
createSubsequentPendingMembership()  : void
Create a paid membership for renewal tests.
createTextCustomField()  : array<string|int, mixed>
Create a custom text fields.
deleteNonDefaultRelationshipTypes()  : void
Delete any extraneous relationship types.
disableTaxAndInvoicing()  : void
Enable Tax and Invoicing
disorganizeOptionValues()  : void
Disorganize our option values to ensure we are not relying on luck.
eliminateUFGroupOne()  : mixed
Ensure we don't have a profile with the id or one to ensure that we are not casting an array to it.
enableTaxAndInvoicing()  : void
Enable Tax and Invoicing
ensureMembershipPriceSetExists()  : void
Ensure the default price set & field exist for memberships.
ensureMySQLMode()  : void
Ensure the specified mysql mode/s are activated.
eventCreatePaid()  : array<string|int, mixed>
Create a paid event.
eventCreateUnpaid()  : array<string|int, mixed>
Create an unpaid event.
eventPriceSetCreate()  : int
Create a price set for an event.
flushFinancialTypeStatics()  : void
Flush statics relating to financial type.
formatMoneyInput()  : string
Format money as it would be input.
getAvailableFieldCombinations()  : array<string|int, mixed>
Get data available for custom fields.
getContributionID()  : int
Get the created contribution ID.
getContributionObject()  : CRM_Contribute_BAO_Contribution
Get the contribution object.
getCustomFieldColumnName()  : string
Get the the column name for the identified custom field.
getCustomFieldID()  : string
Get the custom field name for the relevant key.
getCustomFieldName()  : string
Get the custom field name for the relevant key.
getDefaultSystemLocale()  : string
Get the default system locale.
getDeprecatedProperty()  : mixed
Retrieve a deprecated property, ensuring a deprecation notice is thrown.
getEntity()  : string
Get the entity being acted on.
getEvent()  : array<string|int, mixed>
This retrieves the values used to create the event.
getEventExampleData()  : array<string|int, mixed>
Get example data with which to create the event.
getEventID()  : int
Get the event id of the event created in set up.
getEventValue()  : mixed|null
Get a value from an event used in setup.
getExampleData()  : array<string|int, mixed>
Get example data.
getFinancialTransactionsForContribution()  : array<string|int, mixed>
Get the financial items for the contribution.
getMembershipID()  : int
Get the created contribution ID.
getMembershipLineItem()  : array<string|int, array<string|int, mixed>>
getOptionGroupID()  : string
Get the option group id of the created field.
getOptionGroupName()  : string
Get the option group id of the created field.
getParticipantOrderParams()  : array<string|int, mixed>
Get parameters to set up a multi-line participant order.
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.
getPriceFieldOptions()  : array<string|int, array<string|int, mixed>>
Get the options for the price set.
getPriceSetID()  : int
Get the created price set id.
getRenderedFormContents()  : false|string
Get the rendered contents from a form.
getTablesWithData()  : array<string|int, mixed>
Get an array of tables with rows - useful for diagnosing cleanup issues.
loadXMLDataSet()  : mixed
Load the data that used to be handled by the discontinued dbunit class.
organizeOptionValues()  : void
This undoes the `disorganizeOptionValues` function.
prepareForACLs()  : void
Prepare class for ACLs.
renameLabels()  : mixed
Rename various labels to not match the names.
resetHooks()  : void
Reset any registered hooks.
resetLabels()  : mixed
Undo any label renaming.
restoreUFGroupOne()  : mixed
Bring back UF group one.
revertSetting()  : void
revertTemplateToReservedTemplate()  : void
Reinstate the default template.
runApi4LegacyChain()  : array<string|int, mixed>
runTest()  : mixed
Override to run the test and assert its state.
setCurrencySeparators()  : void
Set the separators for thousands and decimal points.
setDefaultCurrency()  : void
Sets the default currency.
setMonetaryDecimalPoint()  : void
Sets the decimal separator.
setMonetaryThousandSeparator()  : void
Sets the thousand separator.
setPermissions()  : void
Set the permissions to the supplied array.
setUpAutoRenewMembership()  : array<string|int, mixed>|int
Set up a basic auto-renew membership for tests.
setUpForCompleteTransaction()  : array<string|int, mixed>
Common set up routine.
setUpMembershipBlockPriceSet()  : void
Set up a membership block (quick config) price set.
setupMockHandler()  : mixed
Add a mock handler to the authorize.net processor for testing.
setUpRecurringContribution()  : array<string|int, mixed>|int
Set up the basic recurring contribution for tests.
setUpRepeatTransaction()  : array<string|int, mixed>
Set up a repeat transaction.
startCapturingOutput()  : mixed
Start capturing browser output.
swapMessageTemplateForInput()  : void
Replace the template with a test-oriented template designed to show all the variables.
swapMessageTemplateForTestTemplate()  : void
Replace the template with a test-oriented template designed to show all the variables.
updateEvent()  : void
Update an event.
useFrozenTime()  : void
Temporarily freeze time, as perceived through `CRM_Utils_Time`.
validateAllContributions()  : void
Validate all created contributions.
validateAllPayments()  : void
Validate all created payments.
validatePayments()  : void
_contactCreate()  : int
Private helper function for calling civicrm_contact_add.
addProfilesToEvent()  : void
Add profiles to the event.
createEventProfile()  : void
Create a profile attached to an event.
createQuickConfigContributionPage()  : int
Create a price set with a quick config price set.
eventCreatePriceSet()  : void
Create a price set for an event.
unsetID()  : void
Unset the key 'id' from the array

Properties

$apiversion

API version to use for any api calls.

public int $apiversion = 4

$hookClass

Class used for hooks during tests.

public CRM_Utils_Hook_UnitTests $hookClass

This can be used to test hooks within tests. For example in the ACL_PermissionTrait:

$this->hookClass->setHook('civicrm_aclWhereClause', [$this, 'aclWhereHookAllResults']);

$setupIDs

Array of IDs created during test setup routine.

public array<string|int, mixed> $setupIDs = []

The cleanUpSetUpIds method can be used to clear these at the end of the test.

$_params

protected array<string|int, mixed> $_params

Common values to be re-used multiple times within a class - usually to create the relevant entity

$_tablesToTruncate

Track tables we have modified during a test.

protected array<string|int, mixed> $_tablesToTruncate = []

$ids

Array of IDs created to support the test.

protected array<string|int, mixed> $ids = []

e.g $this->ids = ['Contact' => ['descriptive_key' => $contactID], 'Group' => [$groupID]];

$isGetSafe

Has the test class been verified as 'getsafe'.

protected bool $isGetSafe = \FALSE

If a class is getsafe it means that where callApiSuccess is called 'return' is specified or 'return' =>'id' can be added by that function. This is part of getting away from open-ended get calls.

Eventually we want to not be doing these in our test classes & start to work to not do them in our main code base. Note they mainly cause issues for activity.get and contact.get as these are where the too many joins limit is most likely to be hit.

$isLocationTypesOnPostAssert

Should location types be checked to ensure primary addresses are correctly assigned after each test.

protected bool $isLocationTypesOnPostAssert = \TRUE

$isValidateFinancialsOnPostAssert

Should financials be checked after the test but before tear down.

protected bool $isValidateFinancialsOnPostAssert = \TRUE

Ideally all tests (or at least all that call any financial api calls ) should do this but there are some test data issues and some real bugs currently blocking.

$originalSettings

protected array<string|int, mixed> $originalSettings = []

$tempDirs

protected array<string|int, mixed> $tempDirs = []

Array of temporary directory names

Methods

__construct()

Constructor.

public __construct([string $name = NULL ][, array<string|int, mixed> $data = [] ][, string $dataName = '' ]) : mixed

Because we are overriding the parent class constructor, we need to show the same arguments as exist in the constructor of PHPUnit_Framework_TestCase, since PHPUnit_Framework_TestSuite::createTest() creates a ReflectionClass of the Test class and checks the constructor of that class to decide how to set up the test.

Parameters
$name : string = NULL
$data : array<string|int, mixed> = []
$dataName : string = ''

_checkFinancialItem()

public _checkFinancialItem(int $contId, mixed $context) : void
Parameters
$contId : int
$context : mixed

_checkFinancialRecords()

public _checkFinancialRecords(array<string|int, mixed> $params, mixed $context) : mixed
Parameters
$params : array<string|int, mixed>
$context : mixed

_checkFinancialTrxn()

Check financial transaction.

public _checkFinancialTrxn(array<string|int, mixed> $contribution, string $context[, int $instrumentId = NULL ][, array<string|int, mixed> $extraParams = [] ]) : void
Parameters
$contribution : array<string|int, mixed>
$context : string
$instrumentId : int = NULL
$extraParams : array<string|int, mixed> = []
Tags
todo

break this down into sensible functions - most calls to it only use a few lines out of the big if.

_getFinancialItemAmount()

public _getFinancialItemAmount(int $contId) : null|string
Parameters
$contId : int
Tags
throws
CRM_Core_Exception
Return values
null|string

_getFinancialTrxnAmount()

Get financial transaction amount.

public _getFinancialTrxnAmount(int $contId) : null|string
Parameters
$contId : int
Return values
null|string

activityCreate()

Create Activity.

public activityCreate([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>

addDiscountPriceSet()

Add a discount price set to the given event.

public addDiscountPriceSet([string $eventIdentifier = 'PaidEvent' ][, array<string|int, mixed> $discountParameters = [] ][, array<string|int, mixed> $priceSetParameters = [] ][, string $identifier = 'discount' ][, float $fraction = 0.5 ]) : void
Parameters
$eventIdentifier : string = 'PaidEvent'
$discountParameters : array<string|int, mixed> = []
$priceSetParameters : array<string|int, mixed> = []
$identifier : string = 'discount'
$fraction : float = 0.5
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

assertAPIArrayComparison()

Check that api returned 'is_error' => 1 else provide full message

public assertAPIArrayComparison(array<string|int, mixed> $result, mixed $expected[, array<string|int, mixed> $valuesToExclude = [] ][, string $prefix = '' ]) : mixed
Parameters
$result : array<string|int, mixed>
$expected : mixed
$valuesToExclude : array<string|int, mixed> = []
$prefix : string = ''

Extra test to add to message.

assertAPIDeleted()

Check that a deleted item has been deleted.

public assertAPIDeleted(mixed $entity, mixed $id) : mixed
Parameters
$entity : mixed
$id : mixed

assertAPIFailure()

Check that api returned 'is_error' => 1.

public assertAPIFailure(array<string|int, mixed> $apiResult[, string $prefix = '' ][, string|null $expectedError = NULL ]) : void
Parameters
$apiResult : array<string|int, mixed>

Api result.

$prefix : string = ''

Extra test to add to message.

$expectedError : string|null = NULL

assertAPISuccess()

Check that api returned 'is_error' => 0.

public assertAPISuccess(array<string|int, mixed> $apiResult[, string $prefix = '' ]) : mixed
Parameters
$apiResult : array<string|int, mixed>

Api result.

$prefix : string = ''

Extra test to add to message.

assertApproxEquals()

Assert that two numbers are approximately equal, give or take some $tolerance.

public assertApproxEquals(int|float $expected, int|float $actual, int|float $tolerance[, string $message = NULL ]) : mixed
Parameters
$expected : int|float
$actual : int|float
$tolerance : int|float

Any differences <$tolerance are considered irrelevant. Differences >=$tolerance are considered relevant.

$message : string = NULL

assertArrayKeyExists()

public assertArrayKeyExists(string|int $key, array<string|int, mixed> &$list) : mixed
Parameters
$key : string|int
$list : array<string|int, mixed>

assertArrayValueNotNull()

public assertArrayValueNotNull(string|int $key, array<string|int, mixed> &$list) : mixed
Parameters
$key : string|int
$list : array<string|int, mixed>

assertArrayValuesEqual()

Assert the 2 arrays have the same values.

public assertArrayValuesEqual(array<string|int, mixed> $array1, array<string|int, mixed> $array2) : mixed

The order of arrays, and keys of the arrays, do not affect the outcome.

Parameters
$array1 : array<string|int, mixed>
$array2 : array<string|int, mixed>

assertAttributesEquals()

Assert attributes are equal.

public assertAttributesEquals(array<string|int, mixed> $expectedValues, array<string|int, mixed> $actualValues[, string $message = NULL ]) : mixed
Parameters
$expectedValues : array<string|int, mixed>
$actualValues : array<string|int, mixed>
$message : string = NULL
Tags
throws
PHPUnit_Framework_AssertionFailedError

assertDBCompareValue()

Compare a single column value in a retrieved DB record to an expected value.

public assertDBCompareValue(string $daoName, mixed $searchValue, mixed $returnColumn, mixed $searchColumn, mixed $expectedValue, mixed $message) : mixed
Parameters
$daoName : string
$searchValue : mixed
$returnColumn : mixed
$searchColumn : mixed
$expectedValue : mixed
$message : mixed

assertDBCompareValues()

Compare all values in a single retrieved DB record to an array of expected values.

public assertDBCompareValues(string $daoName, array<string|int, mixed> $searchParams, mixed $expectedValues) : mixed
Parameters
$daoName : string
$searchParams : array<string|int, mixed>
$expectedValues : mixed

assertDBNotNull()

Request a record from the DB by seachColumn+searchValue. Success if a record is found.

public assertDBNotNull(string $daoName, mixed $searchValue, mixed $returnColumn, mixed $searchColumn, mixed $message) : null|string
Parameters
$daoName : string
$searchValue : mixed
$returnColumn : mixed
$searchColumn : mixed
$message : mixed
Tags
throws
PHPUnit_Framework_AssertionFailedError
Return values
null|string

assertDBNull()

Request a record from the DB by seachColumn+searchValue. Success if returnColumn value is NULL.

public assertDBNull(string $daoName, mixed $searchValue, mixed $returnColumn, mixed $searchColumn, mixed $message) : mixed
Parameters
$daoName : string
$searchValue : mixed
$returnColumn : mixed
$searchColumn : mixed
$message : mixed

assertDBQuery()

Assert that a SQL query returns a given value.

public assertDBQuery(string|null|int $expected, string $query[, array<string|int, mixed> $params = [] ][, string $message = '' ]) : void

The first argument is an expected value. The remaining arguments are passed to CRM_Core_DAO::singleValueQuery

Example: $this->assertSql(2, 'select count(*) from foo where foo.bar like "%1"', array(1 => array("Whiz", "String")));

Parameters
$expected : string|null|int
$query : string
$params : array<string|int, mixed> = []
$message : string = ''
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

assertDBRowExist()

Request a record from the DB by id. Success if row not found.

public assertDBRowExist(string $daoName, int $id[, null $message = NULL ]) : mixed
Parameters
$daoName : string
$id : int
$message : null = NULL

assertDBRowNotExist()

Request a record from the DB by id. Success if row not found.

public assertDBRowNotExist(string $daoName, int $id[, null $message = NULL ]) : mixed
Parameters
$daoName : string
$id : int
$message : null = NULL

assertDBState()

Generic function to compare expected values after an api call to retrieved.

public assertDBState(mixed $daoName, mixed $id, mixed $match[, bool $delete = FALSE ]) : void

DB values.

Parameters
$daoName : mixed
$id : mixed
$match : mixed
$delete : bool = FALSE
Tags
daoName

string DAO Name of object we're evaluating.

id

int Id of object

match

array Associative array of field name => expected value. Empty if asserting that a DELETE occurred

delete

boolean True if we're checking that a DELETE action occurred.

assertLocationValidity()

Validate that all location entities have exactly one primary.

public assertLocationValidity() : void

This query takes about 2 minutes on a DB with 10s of millions of contacts.

Tags
noinspection

PhpUnhandledExceptionInspection

assertTreeEquals()

Assert that two array-trees are exactly equal.

public assertTreeEquals(array<string|int, mixed> $expected, array<string|int, mixed> $actual) : mixed

The ordering of keys do not affect the outcome (within either the roots or in any child elements).

Error messages will reveal a readable -path-, regardless of how many levels of nesting are present.

Parameters
$expected : array<string|int, mixed>
$actual : array<string|int, mixed>

assertType()

public assertType(string $expected, mixed $actual[, string $message = '' ]) : mixed
Parameters
$expected : string

Ex: 'array', 'object', 'int'

$actual : mixed

The variable/item to check.

$message : string = ''

batchCreate()

Create a sample batch.

public batchCreate() : int
Return values
int

buildEnvironment()

Declare the environment that we wish to run in.

public final static buildEnvironment() : CiviEnvBuilder

TODO: The hope is to get this to align with Civi\Test::headless() and perhaps assimilate other steps from 'setUp()'. The method is reserved while we look for the right split. However, when we're a little further along on that, this should be made overrideable.

Return values
CiviEnvBuilder

callAPIAndDocument()

public callAPIAndDocument(string $entity, string $action, array<string|int, mixed> $params) : array<string|int, mixed>|int
Parameters
$entity : string
$action : string
$params : array<string|int, mixed>
Return values
array<string|int, mixed>|int

callAPIFailure()

This function exists to wrap api functions.

public callAPIFailure(string $entity, string $action[, array<string|int, mixed> $params = [] ][, string $expectedErrorMessage = NULL ][, null $extraOutput = NULL ]) : array<string|int, mixed>|int

so we can ensure they fail where expected & throw exceptions without litterering the test with checks

Parameters
$entity : string
$action : string
$params : array<string|int, mixed> = []
$expectedErrorMessage : string = NULL

Error.

$extraOutput : null = NULL
Return values
array<string|int, mixed>|int

callAPISuccess()

wrap api functions.

public callAPISuccess(string $entity, string $action[, array<string|int, mixed> $params = [] ][, mixed $checkAgainst = NULL ]) : array<string|int, mixed>|int

so we can ensure they succeed & throw exceptions without litterering the test with checks

Parameters
$entity : string
$action : string
$params : array<string|int, mixed> = []
$checkAgainst : mixed = NULL

Optional value to check result against, implemented for getvalue,. getcount, getsingle. Note that for getvalue the type is checked rather than the value for getsingle the array is compared against an array passed in - the id is not compared (for better or worse )

Return values
array<string|int, mixed>|int

callAPISuccessGetCount()

This function exists to wrap api getValue function & check the result so we can ensure they succeed & throw exceptions without littering the test with checks There is a type check in this

public callAPISuccessGetCount(string $entity, array<string|int, mixed> $params[, int $count = NULL ]) : array<string|int, mixed>|int
Parameters
$entity : string
$params : array<string|int, mixed>
$count : int = NULL
Return values
array<string|int, mixed>|int

callAPISuccessGetSingle()

This function exists to wrap api getsingle function & check the result so we can ensure they succeed & throw exceptions without litterering the test with checks

public callAPISuccessGetSingle(string $entity, array<string|int, mixed> $params[, array<string|int, mixed> $checkAgainst = NULL ]) : array<string|int, mixed>|int
Parameters
$entity : string
$params : array<string|int, mixed>
$checkAgainst : array<string|int, mixed> = NULL

Array to compare result against.

  • boolean
  • integer
  • double
  • string
  • array
  • object
Return values
array<string|int, mixed>|int

callAPISuccessGetValue()

This function wraps the getValue api and checks the result.

public callAPISuccessGetValue(string $entity, array<string|int, mixed> $params[, string $type = NULL ]) : array<string|int, mixed>|int
Parameters
$entity : string
$params : array<string|int, mixed>
$type : string = NULL

Per http://php.net/manual/en/function.gettype.php possible types.

  • boolean
  • integer
  • double
  • string
  • array
  • object
Return values
array<string|int, mixed>|int

campaignCreate()

public campaignCreate([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []

Optional parameters.

Return values
int

Campaign ID.

caseCreate()

public caseCreate(array<string|int, mixed> $formValues, string $identifier) : void
Parameters
$formValues : array<string|int, mixed>
$identifier : string

checkArrayEquals()

Get formatted values in the actual and expected result.

public checkArrayEquals(array<string|int, mixed> &$actual, array<string|int, mixed> &$expected) : void
Parameters
$actual : array<string|int, mixed>

Actual calculated values.

$expected : array<string|int, mixed>

Expected values.

checkCreditCardDetails()

Check credit card details in sent mail via API

public checkCreditCardDetails(CiviMailUtils $mut, int $contributionID) : void
Parameters
$mut : CiviMailUtils
$contributionID : int

Contribution ID

checkFinancialTrxnPaymentInstrumentChange()

Check correct financial transaction entries were created for the change in payment instrument.

public checkFinancialTrxnPaymentInstrumentChange(int $contributionID, int $originalInstrumentID, int $newInstrumentID[, int $amount = 100 ]) : void
Parameters
$contributionID : int
$originalInstrumentID : int
$newInstrumentID : int
$amount : int = 100
Tags
throws
CRM_Core_Exception

checkReceiptDetails()

Check receipt details in sent mail via API

public checkReceiptDetails(CiviMailUtils $mut, int $pageID, int $contributionID, array<string|int, mixed> $pageParams) : void
Parameters
$mut : CiviMailUtils
$pageID : int

Page ID

$contributionID : int

Contribution ID

$pageParams : array<string|int, mixed>

civicrm_api()

A stub for the API interface. This can be overriden by subclasses to change how the API is called.

public civicrm_api(mixed $entity, mixed $action[, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|int
Parameters
$entity : mixed
$action : mixed
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>|int

civicrmPostContributionCustom()

Implement post hook.

public civicrmPostContributionCustom(string $op, string $objectName, int|null $objectId) : void
Parameters
$op : string
$objectName : string
$objectId : int|null

CiviUnitTestCase_fatalErrorHandler()

public CiviUnitTestCase_fatalErrorHandler(mixed $message) : mixed
Parameters
$message : mixed
Tags
throws
Exception

contactDelete()

Delete contact, ensuring it is not the domain contact

public contactDelete(int $contactID) : void
Parameters
$contactID : int

Contact ID to delete

contactMembershipCreate()

Create membership.

public contactMembershipCreate(array<string|int, mixed> $params) : int
Parameters
$params : array<string|int, mixed>
Return values
int

contributionCreate()

Create contribution.

public contributionCreate(array<string|int, mixed> $params) : int
Parameters
$params : array<string|int, mixed>

Array of parameters.

Return values
int

id of created contribution

contributionDelete()

Delete contribution.

public contributionDelete(int $contributionID) : array<string|int, mixed>|int
Parameters
$contributionID : int
Return values
array<string|int, mixed>|int

contributionGetnCheck()

This function does a GET & compares the result against the $params.

public contributionGetnCheck(array<string|int, mixed> $params, int $id[, bool $delete = TRUE ]) : void

Use as a double check on Creates.

Parameters
$params : array<string|int, mixed>
$id : int
$delete : bool = TRUE

contributionPageCreate()

Create contribution page.

public contributionPageCreate([array<string|int, mixed> $contributionPageValues = [] ][, string $identifier = 'test' ]) : array<string|int, mixed>
Parameters
$contributionPageValues : array<string|int, mixed> = []
$identifier : string = 'test'
Return values
array<string|int, mixed>

Array of contribution page

contributionStatusProvider()

Dataprovider provides contribution status as [optionvalue=>contribution_status_name] FIXME: buildOptions seems to die in CRM_Core_Config::_construct when in test mode.

public contributionStatusProvider() : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

createCase()

Create and return a case object for the given Client ID.

public createCase(int $clientID[, int|null $loggedInUser = NULL ][, array<string|int, mixed> $extra = [] ][, string $identifier = 'form-created' ]) : CRM_Case_BAO_Case

Note that calling caseCreate directly is preferred.

Parameters
$clientID : int
$loggedInUser : int|null = NULL

Omit or pass NULL to use the same as clientId

$extra : array<string|int, mixed> = []

Optional specific parameters such as start_date

$identifier : string = 'form-created'
Return values
CRM_Case_BAO_Case

createCustomFieldsOfAllTypes()

public createCustomFieldsOfAllTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

createCustomGroup()

Create a custom group.

public createCustomGroup([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []
Return values
int

createCustomGroupWithFieldOfType()

Create a custom group with a single field.

public createCustomGroupWithFieldOfType([array<string|int, mixed> $groupParams = [] ][, string $customFieldType = 'text' ][, string|null $identifier = NULL ][, array<string|int, mixed> $fieldParams = [] ]) : void
Parameters
$groupParams : array<string|int, mixed> = []

Params for the group to be created.

$customFieldType : string = 'text'
$identifier : string|null = NULL
$fieldParams : array<string|int, mixed> = []

createCustomGroupWithFieldsOfAllTypes()

Create a custom group with fields of multiple types.

public createCustomGroupWithFieldsOfAllTypes([array<string|int, mixed> $groupParams = [] ]) : void
Parameters
$groupParams : array<string|int, mixed> = []

createDomainContacts()

Create default domain contacts for the two domains added during test class.

public createDomainContacts() : void

database population.

createExternalAPI()

Create a batch of external API calls which can be executed concurrently.

public createExternalAPI() : ExternalBatch
$calls = $this->createExternalAPI()
   ->addCall('Contact', 'get', ...)
   ->addCall('Contact', 'get', ...)
   ...
   ->run()
   ->getResults();
Tags
throws
PHPUnit_Framework_SkippedTestError
Return values
ExternalBatch

createFinancialTaxAccount()

Create the financial account for tax.

public createFinancialTaxAccount(string $key, array<string|int, mixed> $params) : void
Parameters
$key : string
$params : array<string|int, mixed>

createFinancialTypeWithSalesTax()

Create a financial type with related sales tax config.

public createFinancialTypeWithSalesTax([string $key = 'taxable' ][, array<string|int, mixed> $financialTypeParams = [] ][, array<string|int, mixed> $financialAccountParams = [] ]) : void
Parameters
$key : string = 'taxable'
$financialTypeParams : array<string|int, mixed> = []
$financialAccountParams : array<string|int, mixed> = []
Tags
throws
CRM_Core_Exception

createLocalizedContributionDataProvider()

public createLocalizedContributionDataProvider() : array<string|int, mixed>
Return values
array<string|int, mixed>

createMailing()

Helper function to create new mailing.

public createMailing([array<string|int, mixed> $params = [] ][, string $identifier = 'default' ]) : int
Parameters
$params : array<string|int, mixed> = []
$identifier : string = 'default'
Return values
int

createPendingParticipantContribution()

Create a pending contribution & linked pending participant record (along with an event).

public createPendingParticipantContribution() : int
Return values
int

createPendingPledgeContribution()

Create a pending contribution & linked pending pledge record.

public createPendingPledgeContribution([int $installments = 1 ]) : int
Parameters
$installments : int = 1
Return values
int

createPriceSetWithPage()

Create price set with contribution test for test setup.

public createPriceSetWithPage() : void

This could be merged with 4.5 function setup in api_v3_ContributionPageTest::setUpContributionPage on parent class at some point.

createRepeatMembershipOrder()

Create a pending membership from a recurring order.

public createRepeatMembershipOrder() : void
Tags
throws
CRM_Core_Exception

createTempDir()

Generate a temporary folder.

public createTempDir([string $prefix = 'test-' ]) : string
Parameters
$prefix : string = 'test-'
Return values
string

customDirectories()

Helper to enable/disable custom directory support

public customDirectories(array<string|int, mixed> $customDirs) : mixed
Parameters
$customDirs : array<string|int, mixed>

With members:. 'php_path' Set to TRUE to use the default, FALSE or "" to disable support, or a string path to use another path 'template_path' Set to TRUE to use the default, FALSE or "" to disable support, or a string path to use another path

customFieldCreate()

Create custom field.

public customFieldCreate(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

(custom_group_id) is required.

Return values
array<string|int, mixed>

customFieldDelete()

Delete custom field.

public customFieldDelete(int $customFieldID) : array<string|int, mixed>|int
Parameters
$customFieldID : int
Return values
array<string|int, mixed>|int

customFieldOptionValueCreate()

Create custom field with Option Values.

public customFieldOptionValueCreate(array<string|int, mixed> $customGroup, string $name[, array<string|int, mixed> $extraParams = [] ]) : array<string|int, mixed>|int
Parameters
$customGroup : array<string|int, mixed>
$name : string

Name of custom field.

$extraParams : array<string|int, mixed> = []

Additional parameters to pass through.

Return values
array<string|int, mixed>|int

customGroupCreate()

Create custom group.

public customGroupCreate([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>

CustomGroupCreateByParams()

Existing function doesn't allow params to be over-ridden so need a new one this one allows you to only pass in the params you want to change

public CustomGroupCreateByParams([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|int
Parameters
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>|int

customGroupDelete()

Delete custom group.

public customGroupDelete(int $customGroupID) : array<string|int, mixed>|int
Parameters
$customGroupID : int
Return values
array<string|int, mixed>|int

CustomGroupMultipleCreateByParams()

Create custom group with multi fields.

public CustomGroupMultipleCreateByParams([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>|int
Parameters
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>|int

CustomGroupMultipleCreateWithFields()

Create custom group with multi fields.

public CustomGroupMultipleCreateWithFields([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>

deletedAddedPaymentInstrument()

public deletedAddedPaymentInstrument() : void

deleteMailing()

Helper function to delete mailing.

public deleteMailing(mixed $id) : mixed
Parameters
$id : mixed

dummyProcessorCreate()

Create Payment Processor.

public dummyProcessorCreate([array<string|int, mixed> $processorParams = [] ]) : CRM_Core_Payment_Dummy
Parameters
$processorParams : array<string|int, mixed> = []
Tags
noinspection

PhpIncompatibleReturnTypeInspection

Return values
CRM_Core_Payment_Dummy

Instance of Dummy Payment Processor

enableCiviCampaign()

Enable CiviCampaign Component.

public enableCiviCampaign() : void

enableMultilingual()

Enable multilingual.

public enableMultilingual([array<string|int, mixed>|null $addLocales = NULL ]) : void
Parameters
$addLocales : array<string|int, mixed>|null = NULL

A list of new locales to setup. A locale is initialized by copying from an existing locale.

Ex: Copy from en_US to fr_CA ['en_US' => 'fr_CA'] Ex: Copy from en_US to fr_CA and de_DE ['en_US' => ['fr_CA', 'de_DE]]

entityCustomGroupWithSingleFieldCreate()

Create a custom group with a single text custom field. See participant:testCreateWithCustom for how to use this

public entityCustomGroupWithSingleFieldCreate(string $function, string $filename) : array<string|int, mixed>
Parameters
$function : string

FUNCTION.

$filename : string

$file FILE.

Return values
array<string|int, mixed>

ids of created objects

entityCustomGroupWithSingleStringMultiSelectFieldCreate()

Create a custom group with a single text custom field, multi-select widget, with a variety of option values including upper and lower case.

public entityCustomGroupWithSingleStringMultiSelectFieldCreate(string $function, string $filename) : array<string|int, mixed>

See api_v3_SyntaxConformanceTest:testCustomDataGet for how to use this

Parameters
$function : string

FUNCTION.

$filename : string

$file FILE.

Return values
array<string|int, mixed>

ids of created objects

entityTagAdd()

Add entity(s) to the tag

public entityTagAdd(array<string|int, mixed> $params) : true
Parameters
$params : array<string|int, mixed>
Return values
true

eventCreate()

Create an Event.

public eventCreate([array<string|int, mixed> $params = [] ][, string $identifier = 'event' ]) : array<string|int, mixed>

Note this is not expected to be called directly - call

  • eventCreatePaid
  • eventCreateUnpaid
Parameters
$params : array<string|int, mixed> = []

Name-value pair for an event.

$identifier : string = 'event'
Return values
array<string|int, mixed>

eventDelete()

Delete event.

public eventDelete(int $id) : array<string|int, mixed>|int
Parameters
$id : int

ID of the event.

Return values
array<string|int, mixed>|int

financialAccountDelete()

public financialAccountDelete(string $name) : mixed
Parameters
$name : string

getAndCheck()

public getAndCheck(array<string|int, mixed> $params, int $id, string $entity[, int $delete = 1 ][, string $errorText = '' ]) : void
Parameters
$params : array<string|int, mixed>
$id : int
$entity : string
$delete : int = 1
$errorText : string = ''

getBooleanDataProvider()

Get the boolean options as a provider.

public getBooleanDataProvider() : array<string|int, mixed>
Return values
array<string|int, mixed>

getCustomGroupTable()

Get the table_name for the specified custom group.

public getCustomGroupTable([string $identifier = 'Custom Group' ]) : string
Parameters
$identifier : string = 'Custom Group'
Return values
string

getExpectedRecurResponse()

Get a successful response to setting up a recurring.

public getExpectedRecurResponse() : string
Return values
string

getExpectedSinglePaymentRequest()

Get the expected request from Authorize.net.

public getExpectedSinglePaymentRequest() : string
Return values
string

getExpectedSinglePaymentResponse()

Get the expected response from Authorize.net.

public getExpectedSinglePaymentResponse() : string
Return values
string

getFieldsValuesByType()

Get default field values for the type of field.

public getFieldsValuesByType(string $dataType[, string $htmlType = 'default' ]) : array<string|int, mixed>
Parameters
$dataType : string
$htmlType : string = 'default'
Return values
array<string|int, mixed>

getFinancialTypeID()

Return financial type id on basis of name

public getFinancialTypeID(string $name) : int
Parameters
$name : string

Financial type m/c name

Return values
int

getFormObject()

Instantiate form object.

public getFormObject(string $class[, array<string|int, mixed> $formValues = [] ][, array<string|int, mixed> $urlParameters = [] ]) : CRM_Core_Form|CRM_Event_Form_Registration_Register

We need to instantiate the form to run preprocess, which means we have to trick it about the request method.

Parameters
$class : string

Name of form class.

$formValues : array<string|int, mixed> = []
$urlParameters : array<string|int, mixed> = []
Tags
noinspection

PhpReturnDocTypeMismatchInspection

throws
CRM_Core_Exception
Return values
CRM_Core_Form|CRM_Event_Form_Registration_Register

getLoggedInUser()

Get the logged in user record.

public getLoggedInUser() : int|null
Return values
int|null

getRepeatTransactionNextSchedData()

Get dates for testing.

public getRepeatTransactionNextSchedData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getScheduledDateData()

Get dates for testing.

public getScheduledDateData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getSearchFormObject()

Instantiate form object.

public getSearchFormObject(string $class[, array<string|int, mixed> $formValues = [] ][, string|null $pageName = 'Search' ][, array<string|int, mixed> $searchFormValues = [] ]) : CRM_Core_Form

We need to instantiate the form to run preprocess, which means we have to trick it about the request method.

Parameters
$class : string

Name of form class.

$formValues : array<string|int, mixed> = []
$pageName : string|null = 'Search'
$searchFormValues : array<string|int, mixed> = []

Values for the search form if the form is a task eg. for selected ids 6 & 8: [ 'radio_ts' => 'ts_sel', 'task' => CRM_Member_Task::PDF_LETTER, 'mark_x_6' => 1, 'mark_x_8' => 1, ]

Tags
noinspection

PhpReturnDocTypeMismatchInspection

Return values
CRM_Core_Form

getTestForm()

public getTestForm(mixed $formName, mixed $submittedValues[, array<string|int, mixed> $urlParameters = [] ]) : FormWrapper
Parameters
$formName : mixed
$submittedValues : mixed
$urlParameters : array<string|int, mixed> = []
Return values
FormWrapper

getTestPage()

public getTestPage(string $pageName[, array<string|int, mixed> $urlParameters = [] ]) : PageWrapper
Parameters
$pageName : string
$urlParameters : array<string|int, mixed> = []
Return values
PageWrapper

getThousandSeparators()

Get possible thousand separators.

public getThousandSeparators() : array<string|int, mixed>
Return values
array<string|int, mixed>

groupContactCreate()

Function to add a Group.

public groupContactCreate(int $groupID[, int $totalCount = 10 ][, bool $random = FALSE ]) : int
Parameters
$groupID : int
$totalCount : int = 10
$random : bool = FALSE
Tags
params

array to add group

Return values
int

groupId of created group

groupCreate()

Add a Group.

public groupCreate([array<string|int, mixed> $params = [] ][, string $identifier = 'group' ]) : int
Parameters
$params : array<string|int, mixed> = []
$identifier : string = 'group'
Return values
int

groupId of created group

groupDelete()

Delete a Group.

public groupDelete(int $gid) : mixed
Parameters
$gid : int

householdCreate()

Generic function to create Household, to be used in test cases

public householdCreate([array<string|int, mixed> $params = [] ][, int|string $identifier = 'household_0' ]) : int
Parameters
$params : array<string|int, mixed> = []

parameters for civicrm_contact_add api function call

$identifier : int|string = 'household_0'

If the identifier is numeric (discouraged) it will affect which contact is loaded. Numeric identifiers and values for random other than FALSE are generally discouraged in favour if specifying data in params where variety is needed.

Return values
int

id of Household created

individualCreate()

Generic function to create Individual, to be used in test cases

public individualCreate([array<string|int, mixed> $params = [] ][, int|string $identifier = 'individual_0' ][, bool $random = FALSE ]) : int
Parameters
$params : array<string|int, mixed> = []

parameters for civicrm_contact_add api function call

$identifier : int|string = 'individual_0'

If the identifier is numeric (discouraged) it will affect which contact is loaded. Numeric identifiers and values for random other than FALSE are generally discouraged in favour if specifying data in params where variety is needed.

$random : bool = FALSE

Random is deprecated.

Return values
int

id of Individual created

loadAllFixtures()

Read everything from the datasets directory and insert into the db.

public loadAllFixtures() : void
Tags
noinspection

PhpUnhandledExceptionInspection

locationAdd()

Add a Location.

public locationAdd(int $contactID) : int
Parameters
$contactID : int
Return values
int

location id of created location

locationTypeCreate()

Add a Location Type.

public locationTypeCreate([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []
Return values
int

location id of created location

locationTypeDelete()

Delete a Location Type.

public locationTypeDelete(int $locationTypeID) : void
Parameters
$locationTypeID : int

mappingDelete()

Delete a Mapping

public mappingDelete(int $mappingID) : void
Parameters
$mappingID : int

membershipDelete()

public membershipDelete(int $membershipID) : mixed
Parameters
$membershipID : int

membershipRenewalDate()

public membershipRenewalDate(mixed $durationUnit, mixed $membershipEndDate) : mixed
Parameters
$durationUnit : mixed
$membershipEndDate : mixed

membershipStatusCreate()

public membershipStatusCreate([string $name = 'test member status' ]) : int
Parameters
$name : string = 'test member status'
Return values
int

membershipStatusDelete()

Delete the given membership status, deleting any memberships of the status first.

public membershipStatusDelete(int $membershipStatusID) : void
Parameters
$membershipStatusID : int
Tags
throws
CRM_Core_Exception

membershipTypeCreate()

public membershipTypeCreate([array<string|int, mixed> $params = [] ][, string $identifer = 'test' ]) : int
Parameters
$params : array<string|int, mixed> = []
$identifer : string = 'test'
Return values
int

membershipTypeDelete()

Delete Membership Type.

public membershipTypeDelete(array<string|int, mixed> $params) : mixed
Parameters
$params : array<string|int, mixed>

offsetDefaultPriceSet()

Alter default price set so that the field numbers are not all 1 (hiding errors)

public offsetDefaultPriceSet() : mixed

onPost()

An implementation of hook_civicrm_post used with all our test cases.

public onPost(mixed $op, string $objectName, int $objectId, mixed &$objectRef) : mixed
Parameters
$op : mixed
$objectName : string
$objectId : int
$objectRef : mixed

organizationCreate()

Generic function to create Organisation, to be used in test cases

public organizationCreate([array<string|int, mixed> $params = [] ][, int|string $identifier = 'organization_0' ]) : int
Parameters
$params : array<string|int, mixed> = []

parameters for civicrm_contact_add api function call

$identifier : int|string = 'organization_0'

If the identifier is numeric (discouraged) it will affect which contact is loaded. Numeric identifiers and values for random other than FALSE are generally discouraged in favour if specifying data in params where variety is needed.

Return values
int

id of Organisation created

participantCreate()

Create Participant.

public participantCreate([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []

Array of contact id and event id values.

Return values
int

id of participant created

participantDelete()

Delete participant.

public participantDelete(int $participantID) : array<string|int, mixed>|int
Parameters
$participantID : int
Return values
array<string|int, mixed>|int

participantPaymentCreate()

Create participant payment.

public participantPaymentCreate(int $participantID[, int $contributionID = NULL ]) : int
Parameters
$participantID : int
$contributionID : int = NULL
Return values
int

$id of created payment

participantPaymentDelete()

Delete participant payment.

public participantPaymentDelete(int $paymentID) : mixed
Parameters
$paymentID : int

paymentProcessorAuthorizeNetCreate()

Create test Authorize.net instance.

public paymentProcessorAuthorizeNetCreate([array<string|int, mixed> $params = [] ][, string $identifier = 'authorize_net' ]) : int
Parameters
$params : array<string|int, mixed> = []
$identifier : string = 'authorize_net'
Return values
int

paymentProcessorCreate()

Create an instance of the paypal processor.

public paymentProcessorCreate([array<string|int, mixed> $params = [] ][, string $identifier = 'test' ]) : int
Parameters
$params : array<string|int, mixed> = []
$identifier : string = 'test'
Tags
todo

this isn't a great place to put it - but really it belongs on a class that extends this parent class & we don't have a structure for that yet There is another function to this effect on the PaypalPro test but it appears to be silently failing & the best protection against that is the functions this class affords

Return values
int

$result['id'] payment processor id

paymentProcessorTypeCreate()

public paymentProcessorTypeCreate([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []
Return values
int

pledgeCreate()

Create pledge.

public pledgeCreate(array<string|int, mixed> $params) : int
Parameters
$params : array<string|int, mixed>

Parameters.

Return values
int

id of created pledge

pledgeDelete()

Delete pledge.

public pledgeDelete(int $pledgeID) : void
Parameters
$pledgeID : int

processorCreate()

Create Payment Processor.

public processorCreate([mixed $params = [] ]) : int
Parameters
$params : mixed = []
Return values
int

Payment Processor ID.

quickCleanup()

Quick clean by emptying tables created for the test.

public quickCleanup(array<string|int, mixed> $tablesToTruncate[, bool $dropCustomValueTables = FALSE ]) : void
Parameters
$tablesToTruncate : array<string|int, mixed>
$dropCustomValueTables : bool = FALSE
Tags
noinspection

PhpDocMissingThrowsInspection

noinspection

PhpUnhandledExceptionInspection

quickCleanUpFinancialEntities()

Clean up financial entities after financial tests (so we remember to get all the tables :-))

public quickCleanUpFinancialEntities() : void
Tags
noinspection

PhpUnhandledExceptionInspection

relationshipTypeCreate()

Create a relationship type.

public relationshipTypeCreate([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []
Tags
throws
CRM_Core_Exception
Return values
int

relationshipTypeDelete()

Delete Relatinship Type.

public relationshipTypeDelete(int $relationshipTypeID) : mixed
Parameters
$relationshipTypeID : int

restoreDefaultPriceSetConfig()

Reset the price set config so results exist.

public restoreDefaultPriceSetConfig() : void

restoreMembershipTypes()

Recreate default membership types.

public restoreMembershipTypes() : void
Tags
noinspection

PhpUnhandledExceptionInspection

retrieveEntityFinancialTrxn()

Retrieve entity financial trxn details.

public retrieveEntityFinancialTrxn(array<string|int, mixed> $params[, bool $maxId = FALSE ]) : array<string|int, mixed>
  • only called by tests - to be replaced with $trxn = (array) EntityFinancialTrxn::get() ->addWhere('id', '=', $contributionID) ->addWhere('entity_table', '=', 'civicrm_contribution') ->addSelect('*')->execute();
  • this was used so much in tests I copied it over - but it should go.... the tests just need to use the api.
Parameters
$params : array<string|int, mixed>

an assoc array of name/value pairs.

$maxId : bool = FALSE

To retrieve max id.

Return values
array<string|int, mixed>

runApi4Legacy()

Emulate v3 syntax so we can run api3 tests on v4

public runApi4Legacy(mixed $v3Entity, mixed $v3Action[, array<string|int, mixed> $v3Params = [] ]) : array<string|int, mixed>|int
Parameters
$v3Entity : mixed
$v3Action : mixed
$v3Params : array<string|int, mixed> = []
Tags
throws
CRM_Core_Exception
throws
Exception
Return values
array<string|int, mixed>|int

sampleContact()

Helper function for getting sample contact properties.

public sampleContact(string $contact_type[, int $seq = 0 ][, bool $random = FALSE ]) : array<string|int, mixed>
Parameters
$contact_type : string

enum contact type: Individual, Organization

$seq : int = 0

sequence number for the values of this type

$random : bool = FALSE
Return values
array<string|int, mixed>

properties of sample contact (ie. $params for API call)

selectWhereClauseHook()

public selectWhereClauseHook(string $entity, array<string|int, mixed> &$clauses) : void
Parameters
$entity : string
$clauses : array<string|int, mixed>
Tags
implements

CRM_Utils_Hook::selectWhereClause

setMockSettingsMetaData()

Temporarily alter the settings-metadata to add a mock setting.

public setMockSettingsMetaData(mixed $extras) : void

WARNING: The setting metadata will disappear on the next cache-clear.

Parameters
$extras : mixed

setupACL()

Set up an acl allowing contact to see 2 specified groups - $this->_permissionedGroup & $this->_permissionedDisabledGroup

public setupACL([bool $isProfile = FALSE ]) : void

You need to have pre-created these groups & created the user e.g $this->createLoggedInUser(); $this->_permissionedDisabledGroup = $this->groupCreate(array('title' => 'pick-me-disabled', 'is_active' => 0, 'name' => 'pick-me-disabled')); $this->_permissionedGroup = $this->groupCreate(array('title' => 'pick-me-active', 'is_active' => 1, 'name' => 'pick-me-active'));

Parameters
$isProfile : bool = FALSE
Tags
throws
DBQueryException

setupForSmsTests()

Setup or clean up SMS tests

public setupForSmsTests([bool $teardown = FALSE ]) : mixed
Parameters
$teardown : bool = FALSE
Tags
throws
CRM_Core_Exception

setupMembershipRecurringPaymentProcessorTransaction()

We don't have a good way to set up a recurring contribution with a membership so let's just do one then alter it

public setupMembershipRecurringPaymentProcessorTransaction([array<string|int, mixed> $params = [] ][, array<string|int, mixed> $contributionParams = [] ]) : void
Parameters
$params : array<string|int, mixed> = []

Optionally modify params for membership/recur (duration_unit/frequency_unit)

$contributionParams : array<string|int, mixed> = []

Parameters to pass to contribution create.

Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

setUpPendingContribution()

Set up a pending transaction with a specific price field id.

public setUpPendingContribution(int $priceFieldValueID[, string $key = 'first' ][, array<string|int, mixed> $contributionParams = [] ][, array<string|int, mixed> $lineParams = [] ][, array<string|int, mixed> $membershipParams = [] ]) : void
Parameters
$priceFieldValueID : int
$key : string = 'first'
$contributionParams : array<string|int, mixed> = []
$lineParams : array<string|int, mixed> = []
$membershipParams : array<string|int, mixed> = []

setupRecurringPaymentProcessorTransaction()

Set up initial recurring payment allowing subsequent IPN payments.

public setupRecurringPaymentProcessorTransaction([array<string|int, mixed> $recurParams = [] ][, array<string|int, mixed> $contributionParams = [] ][, string $identifier = 'default' ]) : void
Parameters
$recurParams : array<string|int, mixed> = []

(Optional)

$contributionParams : array<string|int, mixed> = []

(Optional)

$identifier : string = 'default'

smartGroupCreate()

Create a smart group.

public smartGroupCreate([array<string|int, mixed> $smartGroupParams = [] ][, array<string|int, mixed> $groupParams = [] ][, string $contactType = 'Household' ]) : int

By default it will be a group of households.

Parameters
$smartGroupParams : array<string|int, mixed> = []
$groupParams : array<string|int, mixed> = []
$contactType : string = 'Household'
Return values
int

tagCreate()

Create Tag.

public tagCreate([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>

result of created tag

tagDelete()

Delete Tag.

public tagDelete(int $tagID) : int
Parameters
$tagID : int

ID of the tag to be deleted.

Return values
int

testBillingAddress()

Test to check whether contact billing address is used when no contribution address

public testBillingAddress() : void

testCardTypeAndPanTruncation()

function to test card_type and pan truncation.

public testCardTypeAndPanTruncation() : void

testCheckTaxAmount()

CRM-19126 Add test to verify when complete transaction is called tax amount is not changed.

public testCheckTaxAmount(string $thousandSeparator) : void

We start of with a pending contribution.

  • total_amount (input) = 100
  • total_amount post save (based on tax being added) = 105
  • net_amount = 95
  • fee_amount = 5
  • non_deductible_amount = 10
  • tax rate = 5%
  • tax_amount = 5
  • sum of (calculated) line items = 105

Note the fee_amount should really be set when the payment is received and whatever the non_deductible amount is, it is ignored.

The fee amount when the payment comes in is 6 rather than 5. The net_amount and fee_amount should change, but not the total_amount or the line items.

Parameters
$thousandSeparator : string

punctuation used to refer to thousands.

Tags
throws
CRM_Core_Exception
dataProvider

getThousandSeparators

testCleanMoney()

Test the "clean money" functionality.

public testCleanMoney() : void

testCompleteTransaction()

Test completing a transaction via the API.

public testCompleteTransaction() : void

Note that we are creating a logged in user because email goes out from that person

testCompleteTransactionContributionPageFromAddress()

Complete the transaction using the template with all the possible.

public testCompleteTransactionContributionPageFromAddress() : void

testCompleteTransactionEuro()

Test completing a transaction via the API with a non-USD transaction.

public testCompleteTransactionEuro() : void
Tags
group

locale

testCompleteTransactionFeeAmount()

Test completing a transaction via the API.

public testCompleteTransactionFeeAmount() : void

Note that we are creating a logged in user because email goes out from that person

testCompleteTransactionForRecurring()

Test that $is_recur is assigned to the receipt.

public testCompleteTransactionForRecurring() : void

testCompleteTransactionMembershipPriceSet()

Test membership is renewed when transaction completed.

public testCompleteTransactionMembershipPriceSet() : void
Tags
throws
CRM_Core_Exception

testCompleteTransactionMembershipPriceSetTwoTerms()

Test membership is renewed for 2 terms when transaction completed based on the line item having 2 terms as qty.

public testCompleteTransactionMembershipPriceSetTwoTerms() : void

Also check that altering the qty for the most recent contribution results in repeattransaction picking it up.

Tags
throws
CRM_Core_Exception

testCompleteTransactionNetAmountOK()

Test completing a transaction does not 'mess' with net amount (CRM-15960).

public testCompleteTransactionNetAmountOK() : void

testCompleteTransactionSetStatusToInProgress()

Test completing first transaction in a recurring series.

public testCompleteTransactionSetStatusToInProgress(array<string|int, mixed> $dataSet) : void

The status should be set to 'in progress' and the next scheduled payment date calculated.

Parameters
$dataSet : array<string|int, mixed>
Tags
dataProvider

getScheduledDateData

throws
Exception

testCompleteTransactionUpdatePledgePayment()

Test completing a pledge with the completeTransaction api.. Note that we are creating a logged in user because email goes out from that person.

public testCompleteTransactionUpdatePledgePayment() : void

testCompleteTransactionWithEmailReceiptInput()

CRM-1960 - Test to ensure that completetransaction respects the is_email_receipt setting

public testCompleteTransactionWithEmailReceiptInput() : void

testCompleteTransactionWithEmailReceiptInputTrue()

CRM-19710 - Test to ensure that completetransaction respects the input for is_email_receipt setting.

public testCompleteTransactionWithEmailReceiptInputTrue() : void

If passed in it will override the default from contribution page.

Tags
throws
CRM_Core_Exception

testCompleteTransactionWithParticipantRecord()

Test completing a transaction with an event via the API.

public testCompleteTransactionWithParticipantRecord() : void

Note that we are creating a logged-in user because email goes out from that person

testCompleteTransactionWithReceiptDateSet()

CRM-14151 - Test completing a transaction via the API.

public testCompleteTransactionWithReceiptDateSet() : void

testCompleteTransactionWithTestTemplate()

Complete the transaction using the template with all the possible.

public testCompleteTransactionWithTestTemplate() : void

testContributionGetUnique()

Test getunique api call for Contribution entity

public testContributionGetUnique() : void

testCreateBAODefaults()

Test that BAO defaults work.

public testCreateBAODefaults() : void

testCreateCheckContribution()

Test Creating a check contribution with original check_number field

public testCreateCheckContribution() : void

testCreateContributionChainedLineItems()

Test checks that passing in line items suppresses the create mechanism.

public testCreateContributionChainedLineItems() : void

testCreateContributionNoLineItems()

Test creating a contribution without skipLineItems.

public testCreateContributionNoLineItems() : void

testCreateContributionNullOutThankyouDate()

Create test with unique field name on source.

public testCreateContributionNullOutThankyouDate() : void

testCreateContributionOffline()

public testCreateContributionOffline() : void

testCreateContributionOnline()

Function tests that additional financial records are created when online contribution is created.

public testCreateContributionOnline() : void

testCreateContributionPayLaterOnline()

Tests that additional financial records are created.

public testCreateContributionPayLaterOnline() : void

Checks when online contribution with pay later option is created

testCreateContributionPendingOnline()

Function tests that additional financial records are created for online contribution with pending option.

public testCreateContributionPendingOnline() : void

testCreateContributionSource()

Create test with unique field name on source.

public testCreateContributionSource() : void

testCreateContributionSourceInvalidContact()

Create test with unique field name on source.

public testCreateContributionSourceInvalidContact() : void

testCreateContributionWithFee()

Function tests that additional financial records are created when fee amount is recorded.

public testCreateContributionWithFee() : void

testCreateContributionWithHonoreeContact()

Test creating contribution with Soft Credit by passing in honor_contact_id.

public testCreateContributionWithHonoreeContact() : void

testCreateContributionWithNote()

Test note created correctly.

public testCreateContributionWithNote() : void

testCreateContributionWithNoteUniqueNameAliases()

public testCreateContributionWithNoteUniqueNameAliases() : void

testCreateContributionWithPaymentInstrument()

Test create with valid payment instrument.

public testCreateContributionWithPaymentInstrument() : void

testCreateContributionWithSoftCredit()

This is the test for creating soft credits.

public testCreateContributionWithSoftCredit() : void

testCreateContributionWithSoftCreditDefaults()

public testCreateContributionWithSoftCreditDefaults() : void

testCreateDefaultNow()

Create test with unique field name on source.

public testCreateDefaultNow(string $thousandSeparator) : void
Parameters
$thousandSeparator : string

punctuation used to refer to thousands.

Tags
dataProvider

getThousandSeparators

testCreateEmptyContributionIDUseDonation()

Create an contribution_id=FALSE and financial_type_id=Donation.

public testCreateEmptyContributionIDUseDonation() : void

testCreateGetFieldsWithCustom()

Check with complete array + custom field.

public testCreateGetFieldsWithCustom() : void

Note that the test is written on purpose without any variables specific to participant so it can be replicated into other entities and / or moved to the automated test suite

testCreateLocalizedContribution()

public testCreateLocalizedContribution(float|int|string $totalAmount, string $decimalPoint, string $thousandSeparator, string $currency, bool $expectedResult) : void
Parameters
$totalAmount : float|int|string
$decimalPoint : string
$thousandSeparator : string
$currency : string
$expectedResult : bool
Tags
dataProvider

createLocalizedContributionDataProvider

group

locale

testCreateUpdateChargebackContributionCustomAccount()

Refund a contribution for a financial type with a contra account.

public testCreateUpdateChargebackContributionCustomAccount() : void

CRM-17951 the contra account is a financial account with a relationship to a financial type. It is not always configured but should be reflected in the financial_trxn & financial_item table if it is.

testCreateUpdateChargebackContributionDefaultAccount()

Refund a contribution for a financial type with a contra account.

public testCreateUpdateChargebackContributionDefaultAccount() : void

CRM-17951 the contra account is a financial account with a relationship to a financial type. It is not always configured but should be reflected in the financial_trxn & financial_item table if it is.

Tags
throws
CRM_Core_Exception

testCreateUpdateContribution()

Test Updating a Contribution.

public testCreateUpdateContribution() : void

CHANGE: we require the API to do an incremental update

testCreateUpdateContributionCancelPending()

Function tests that financial records are added when Pending Contribution is Canceled.

public testCreateUpdateContributionCancelPending() : void
Tags
throws
CRM_Core_Exception

testCreateUpdateContributionChangeFinancialType()

Function tests that financial records are added when Financial Type is Changed.

public testCreateUpdateContributionChangeFinancialType() : void

testCreateUpdateContributionChangeTotal()

Function tests that line items, financial records are updated when contribution amount is changed.

public testCreateUpdateContributionChangeTotal() : void
Tags
throws
CRM_Core_Exception

testCreateUpdateContributionInValidStatusChange()

Function tests invalid contribution status change.

public testCreateUpdateContributionInValidStatusChange() : void

testCreateUpdateContributionPayLater()

Function tests that line items, financial records are updated when pay later contribution is received.

public testCreateUpdateContributionPayLater() : void

testCreateUpdateContributionPaymentInstrument()

Function tests that financial records are updated when Payment Instrument is changed.

public testCreateUpdateContributionPaymentInstrument() : void

testCreateUpdateContributionRefund()

Function tests that financial records are added when Contribution is Refunded.

public testCreateUpdateContributionRefund() : void

testCreateUpdateContributionRefundRefundAndTrxnIDPassedIn()

Function tests that trxn_id is set when passed in.

public testCreateUpdateContributionRefundRefundAndTrxnIDPassedIn() : void

Here we ensure that the civicrm_contribution.trxn_id is set when trxn_id is passed in but if refund_trxn_id is different then that is kept for the refund transaction.

testCreateUpdateContributionRefundRefundNullTrxnIDPassedIn()

Function tests that refund_trxn_id is set when passed in empty.

public testCreateUpdateContributionRefundRefundNullTrxnIDPassedIn() : void

Here we ensure that the civicrm_contribution.trxn_id is set when trxn_id is passed in but if refund_trxn_id isset but empty then that is kept for the refund transaction.

testCreateUpdateContributionRefundTrxnIDPassedIn()

Function tests that trxn_id is set when passed in.

public testCreateUpdateContributionRefundTrxnIDPassedIn() : void

Here we ensure that the civicrm_financial_trxn.trxn_id & the civicrm_contribution.trxn_id are set when trxn_id is passed in.

testCreateUpdateContributionWithFeeAmountChangeFinancialType()

Function tets that financial records are correctly added when financial type is changed

public testCreateUpdateContributionWithFeeAmountChangeFinancialType() : void

testCreateUpdateNegativeContributionPaymentInstrument()

Function tests that financial records are updated when Payment Instrument is changed when amount is negative.

public testCreateUpdateNegativeContributionPaymentInstrument() : void

testCreateUpdateRefundContributionConfiguredContraAccount()

Refund a contribution for a financial type with a contra account.

public testCreateUpdateRefundContributionConfiguredContraAccount() : void

CRM-17951 the contra account is a financial account with a relationship to a financial type. It is not always configured but should be reflected in the financial_trxn & financial_item table if it is.

testCreateUpdateWithoutChangingPendingStatus()

Test that update does not change status id CRM-15105.

public testCreateUpdateWithoutChangingPendingStatus() : void

testCustomValueOptionLabelTest()

Test that passing in label for an option value linked to a custom field works

public testCustomValueOptionLabelTest() : void
Tags
see

dev/core#1816

testDeleteChainedGetSingle()

Test that getsingle can be chained with delete.

public testDeleteChainedGetSingle() : void

testDeleteEmptyParamsContribution()

Attempt (but fail) to delete a contribution without parameters.

public testDeleteEmptyParamsContribution() : void

testDeleteWrongParamContribution()

public testDeleteWrongParamContribution() : void

testFilterCancelReason()

Test cancel reason works as a filter.

public testFilterCancelReason() : void

testGetContributionByInvoice()

CRM-16227 introduces invoice_id as a parameter.

public testGetContributionByInvoice() : void

testGetContributionByPaymentInstrument()

public testGetContributionByPaymentInstrument() : void

testGetContributionByTotalAmount()

Test retrieval by total_amount works.

public testGetContributionByTotalAmount() : void

testGetContributionLegacyBehaviour()

We need to ensure previous tested api contract behaviour still works.

public testGetContributionLegacyBehaviour() : void

testGetContributionReturnFunctionality()

Test the 'return' param works for all fields.

public testGetContributionReturnFunctionality() : void

testGetCreditNoteCaseInsensitive()

Check the credit note retrieval is case-insensitive.

public testGetCreditNoteCaseInsensitive() : void

testGetTestContribution()

Test that test contributions can be retrieved.

public testGetTestContribution() : void

testPaymentDontChangeReceiveDate()

Make sure that recording a payment doesn't alter the receive_date of a pending contribution.

public testPaymentDontChangeReceiveDate() : void

testPaymentVerifyPaymentInstrumentChange()

Make sure that recording a payment with Different Payment Instrument update main contribution record payment instrument too. If multiple Payment Recorded, last payment record payment (when No more due) instrument set to main payment

public testPaymentVerifyPaymentInstrumentChange() : void

testPendingToCompleteContribution()

Test if renewal activity is created after changing Pending contribution to Completed via offline

public testPendingToCompleteContribution() : void

testRepeatContributionWithTaxAmount()

Test Repeat Transaction Contribution with Tax amount.

public testRepeatContributionWithTaxAmount() : void

https://lab.civicrm.org/dev/core/issues/806

testRepeatTransaction()

Test repeat contribution successfully creates line item.

public testRepeatTransaction() : void

Disable CiviMember to provide cover for that situation.

This is just testing a contribution which matches the recurring.

testRepeatTransactionAcceptRecurID()

Test repeat contribution accepts recur_id instead of original_contribution_id.

public testRepeatTransactionAcceptRecurID() : void

testRepeatTransactionAlteredAmount()

CRM-16397 test that amount can be overidden for single line item contributions.

public testRepeatTransactionAlteredAmount() : void

This override can take the form of a parameter or an update to the recurring record.

testRepeatTransactionIsTest()

Test repeat contribution successfully creates is_test transaction.

public testRepeatTransactionIsTest() : void

testRepeatTransactionLineItems()

Test repeat contribution successfully creates line items (plural).

public testRepeatTransactionLineItems() : void

testRepeatTransactionMembershipCreatePendingContribution()

CRM-20008 Tests repeattransaction creates pending membership.

public testRepeatTransactionMembershipCreatePendingContribution() : void
Tags
throws
CRM_Core_Exception

testRepeatTransactionMembershipRenewCompletedContribution()

CRM-19945 Tests that Contribute.repeattransaction renews a membership when contribution status=Completed

public testRepeatTransactionMembershipRenewCompletedContribution() : void

testRepeatTransactionMembershipRenewContributionNotCompleted()

CRM-19945 Tests that Contribute.repeattransaction DOES NOT renew a membership when contribution status=Failed

public testRepeatTransactionMembershipRenewContributionNotCompleted(array<string|int, mixed> $contributionStatus) : void
Parameters
$contributionStatus : array<string|int, mixed>
Tags
dataProvider

contributionStatusProvider

testRepeatTransactionPassedInCampaign()

CRM-16397 test appropriate action if campaign has been passed in.

public testRepeatTransactionPassedInCampaign() : void

testRepeatTransactionPassedInFinancialType()

Test financial_type_id override behaviour with a single line item.

public testRepeatTransactionPassedInFinancialType() : void

CRM-17718 a passed in financial_type_id is allowed to override the original contribution where there is only one line item.

testRepeatTransactionPassedInFinancialTypeTwoLineItems()

Test financial_type_id override behaviour with a single line item.

public testRepeatTransactionPassedInFinancialTypeTwoLineItems() : void

CRM-17718 a passed in financial_type_id is not allowed to override the original contribution where there is more than one line item.

testRepeatTransactionPassedInStatus()

Test repeat contribution passed in status.

public testRepeatTransactionPassedInStatus() : void

testRepeatTransactionPreviousContributionRefunded()

Test repeat contribution accepts recur_id instead of original_contribution_id.

public testRepeatTransactionPreviousContributionRefunded() : void

testRepeattransactionRenewMembershipOldMembership()

This is one of those tests that locks in existing behaviour.

public testRepeattransactionRenewMembershipOldMembership() : void

I feel like correct behaviour is arguable & has been discussed in the past. However, if the membership has a date which says it should be expired then the result of repeattransaction is to push that date to be one membership term from 'now'.

Tags
throws
CRM_Core_Exception

testRepeatTransactionTestRecurId()

CRM-19873 Test repeattransaction if contribution_recur_id is a test.

public testRepeatTransactionTestRecurId() : void

testRepeatTransactionUpdatedCampaign()

CRM-17718 campaign stored on contribution recur gets priority.

public testRepeatTransactionUpdatedCampaign() : void

This reflects the fact we permit people to update them.

testRepeatTransactionUpdatedFinancialType()

CRM-17718 test appropriate action if financial type has changed for single line items.

public testRepeatTransactionUpdatedFinancialType() : void

testRepeatTransactionUpdatedFinancialTypeAndNotEquals()

CRM-20685 Repeattransaction produces incorrect Financial Type ID (in specific circumstance) - if number of lineItems = 1.

public testRepeatTransactionUpdatedFinancialTypeAndNotEquals() : void

This case happens when the line item & contribution do not have the same type in his initiating transaction.

testRepeatTransactionUpdateNextSchedContributionDate()

Test repeatTransaction with installments and next_sched_contribution_date

public testRepeatTransactionUpdateNextSchedContributionDate(array<string|int, mixed> $dataSet) : void
Parameters
$dataSet : array<string|int, mixed>
Tags
dataProvider

getRepeatTransactionNextSchedData

testRepeatTransactionWithCustomData()

Test custom data is copied over from the template transaction.

public testRepeatTransactionWithCustomData() : void

(Over time various discussions have deemed this to be the most recent one, allowing users to alter custom data going forwards. This is implemented for line items already.

Tags
throws
CRM_Core_Exception

testRepeatTransactionWithNonCreditCardDefault()

Test repeat contribution uses the Payment Processor' payment_instrument setting.

public testRepeatTransactionWithNonCreditCardDefault() : void
Tags
throws
CRM_Core_Exception

testRepeatTransactionWithPledgePayment()

Test repeating a pledge with the repeatTransaction api.

public testRepeatTransactionWithPledgePayment() : void

.

Tags
throws
CRM_Core_Exception

testSearch()

Test civicrm_contribution_search. Success expected.

public testSearch() : void

testSearchEmptyParams()

Test civicrm_contribution_search with empty params.

public testSearchEmptyParams() : void

All available contributions expected.

testSendConfirmationPayLater()

Test sending a mail via the API.

public testSendConfirmationPayLater() : void

This simulates webform_civicrm using pay later contribution page

Tags
throws
CRM_Core_Exception

testSendconfirmationWithMembershipReceiptText()

Test custom receipt_text for a membership with Contribution.sendconfirmation

public testSendconfirmationWithMembershipReceiptText() : void

testSendMail()

Test sending a mail via the API.

public testSendMail() : void

testSendMailEvent()

Test sending a mail via the API.

public testSendMailEvent() : void

testSendMailWithNoFromSetFallToDomain()

Test sending a mail via the API.

public testSendMailWithNoFromSetFallToDomain() : void

testSendMailWithRepeatTransactionAPIFailtoDomain()

Test sending a mail via the API.

public testSendMailWithRepeatTransactionAPIFailtoDomain() : void

testSendMailWithRepeatTransactionAPIFallToContributionPage()

Test sending a mail via the API.

public testSendMailWithRepeatTransactionAPIFallToContributionPage() : void

testSendMailWithRepeatTransactionAPIFalltoSystemFromNoDefaultFrom()

Test sending a mail via the API.

public testSendMailWithRepeatTransactionAPIFalltoSystemFromNoDefaultFrom() : void
Tags
throws
CRM_Core_Exception

testSetCustomDataInCreateAndHook()

Test setting custom data in the create hook.

public testSetCustomDataInCreateAndHook() : void

testUpdateContributionNetAmountVariants()

Check that net_amount is updated when a contribution is updated.

public testUpdateContributionNetAmountVariants() : void

Update fee amount AND total amount, just fee amount, just total amount and neither to check that net_amount is keep updated.

uFFieldCreate()

Create a UFField.

public uFFieldCreate([array<string|int, mixed> $params = [] ]) : mixed
Parameters
$params : array<string|int, mixed> = []

ufjoinCreate()

Add a UF Join Entry.

public ufjoinCreate([array<string|int, mixed>|null $params = NULL ]) : int
Parameters
$params : array<string|int, mixed>|null = NULL
Return values
int

$id of created UF Join

useMultilingual()

Temporarily use multilingual.

public useMultilingual(array<string|int, mixed> $addLocales) : CRM_Utils_AutoClean
Parameters
$addLocales : array<string|int, mixed>

A list of new locales to setup. A locale is initialized by copying from an existing locale.

Ex: Copy from en_US to fr_CA ['en_US' => 'fr_CA'] Ex: Copy from en_US to fr_CA and de_DE ['en_US' => ['fr_CA', 'de_DE]]

Return values
CRM_Utils_AutoClean

A reference to the temporary configuration. Once removed, the system will revert to single language.

useTransaction()

Wrap the entire test case in a transaction.

public useTransaction([bool $nest = TRUE ]) : mixed

Only subsequent DB statements will be wrapped in TX -- this cannot retroactively wrap old DB statements. Therefore, it makes sense to call this at the beginning of setUp().

Note: Recall that TRUNCATE and ALTER will force-commit transactions, so this option does not work with, e.g., custom-data.

WISHLIST: Monitor SQL queries in unit-tests and generate an exception if TRUNCATE or ALTER is called while using a transaction.

Parameters
$nest : bool = TRUE

Whether to use nesting or reference-counting.

versionThreeAndFour()

Get the api versions to test.

public versionThreeAndFour() : array<string|int, mixed>
Return values
array<string|int, mixed>

addLocationBlockToDomain()

Add an address block to the current domain.

protected addLocationBlockToDomain() : void
Tags
noinspection

PhpUnhandledExceptionInspection

addOptionToCustomField()

Add another option to the custom field.

protected addOptionToCustomField(string $key, array<string|int, mixed> $values) : int
Parameters
$key : string
$values : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
int

addProfile()

Add a profile to a contribution page.

protected addProfile(string $name, int $contributionPageID[, string $module = 'CiviContribute' ]) : mixed
Parameters
$name : string
$contributionPageID : int
$module : string = 'CiviContribute'

assertAttachmentExistence()

Assert the attachment exists.

protected assertAttachmentExistence(bool $exists, array<string|int, mixed> $apiResult) : void
Parameters
$exists : bool
$apiResult : array<string|int, mixed>

assertLike()

Assert 2 sql strings are the same, ignoring double spaces.

protected assertLike(string $expectedSQL, string $actualSQL[, string $message = 'different sql' ]) : void
Parameters
$expectedSQL : string
$actualSQL : string
$message : string = 'different sql'

assertMailSentContainingHeaderString()

Assert that the sent mail included the supplied string.

protected assertMailSentContainingHeaderString(string $string[, int $mailIndex = 0 ]) : void
Parameters
$string : string
$mailIndex : int = 0

assertMailSentContainingHeaderStrings()

Assert that the sent mail included the supplied strings.

protected assertMailSentContainingHeaderStrings(array<string|int, mixed> $strings[, int $mailIndex = 0 ]) : void
Parameters
$strings : array<string|int, mixed>
$mailIndex : int = 0

assertMailSentContainingString()

Assert that the sent mail included the supplied string.

protected assertMailSentContainingString(string $string[, int $mailIndex = 0 ]) : void
Parameters
$string : string
$mailIndex : int = 0

assertMailSentContainingStrings()

Assert that the sent mail included the supplied strings.

protected assertMailSentContainingStrings(array<string|int, mixed> $strings[, int $mailIndex = 0 ]) : void
Parameters
$strings : array<string|int, mixed>
$mailIndex : int = 0

assertMailSentCount()

Assert the right number of mails were sent.

protected assertMailSentCount(int $count) : void
Parameters
$count : int

assertMailSentNotContainingString()

Assert that the sent mail included the supplied string.

protected assertMailSentNotContainingString(string $string[, int $mailIndex = 0 ]) : void
Parameters
$string : string
$mailIndex : int = 0

assertMailSentNotContainingStrings()

Assert that the sent mail included the supplied strings.

protected assertMailSentNotContainingStrings(array<string|int, mixed> $strings[, int $mailIndex = 0 ]) : void
Parameters
$strings : array<string|int, mixed>
$mailIndex : int = 0

assertMailSentTo()

Assert that the sent mail included the supplied strings.

protected assertMailSentTo(array<string|int, mixed> $recipients[, int $mailIndex = 0 ]) : void
Parameters
$recipients : array<string|int, mixed>
$mailIndex : int = 0

assertOutputNotContainsString()

Assert that the status set does not contain the given string.

protected assertOutputNotContainsString(string $string) : void

.

Parameters
$string : string

assertPostConditions()

CHeck that all tests that have created payments have created them with the right financial entities.

protected assertPostConditions() : void
Tags
throws
CRM_Core_Exception

assertPrematureExit()

protected assertPrematureExit() : void

assertRequestValid()

Assert the request sent to Authorize.net contains the expected values.

protected assertRequestValid([array<string|int, mixed> $expected = [] ]) : void
Parameters
$expected : array<string|int, mixed> = []

assertTemplateVariable()

protected assertTemplateVariable(mixed $name, mixed $expected) : void
Parameters
$name : mixed
$expected : mixed

assertValidationError()

Assert that the sent mail included the supplied string.

protected assertValidationError(array<string|int, mixed> $errors) : void
Parameters
$errors : array<string|int, mixed>

captureOutputToCSV()

Stop capturing browser output and return as a csv.

protected captureOutputToCSV([bool $isFirstRowHeaders = TRUE ]) : Reader
Parameters
$isFirstRowHeaders : bool = TRUE
Tags
throws
Exception
Return values
Reader

cleanUpAfterACLs()

Reset after ACLs.

protected cleanUpAfterACLs() : mixed

cleanupCustomGroups()

Delete any existing custom data groups.

protected cleanupCustomGroups() : void

cleanUpSetUpIDs()

Cleanup function for contents of $this->ids.

protected cleanUpSetUpIDs() : mixed

This is a best effort cleanup to use in tear downs etc.

It will not fail if the data has already been removed (some tests may do their own cleanup).

createAuthorizeNetProcessor()

Create an AuthorizeNet processors with a configured mock handler.

protected createAuthorizeNetProcessor() : mixed
Tags
throws
CRM_Core_Exception

createAutoCompleteCustomField()

Create custom select field.

protected createAutoCompleteCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createBooleanCustomField()

Create a custom text fields.

protected createBooleanCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createContactReferenceCustomField()

Create a custom text fields.

protected createContactReferenceCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createContributionAndMembershipOrder()

Create an order with a contribution AND a membership line item.

protected createContributionAndMembershipOrder() : void
Tags
throws
CRM_Core_Exception

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.

createCountryCustomField()

Create a custom country fields.

protected createCountryCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createDateCustomField()

Create a custom field of type date.

protected createDateCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createEventOrder()

Create an order for an event.

protected createEventOrder([array<string|int, mixed> $orderParams = [] ]) : mixed
Parameters
$orderParams : array<string|int, mixed> = []
Tags
throws
CRM_Core_Exception

createExtraneousContribution()

Create an extraneous contribution to throw off any 'number one bugs'.

protected createExtraneousContribution() : mixed

Ie this means our real data starts from 2 & we won't hit 'pretend passes' just because the number 1 is used for multiple entities.

createFileCustomField()

Create a custom text fields.

protected createFileCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createFinancialType()

Create Financial Type.

protected createFinancialType([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []
Return values
array<string|int, mixed>

createInitialPaidMembership()

Create a paid membership for renewal tests.

protected createInitialPaidMembership() : void

createIntCustomField()

Create a custom text fields.

protected createIntCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createIntegerRadioCustomField()

Create a custom field of type radio with integer values.

protected createIntegerRadioCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createJoinedProfile()

Add a profile to a contribution page.

protected createJoinedProfile(array<string|int, mixed> $joinParams[, array<string|int, mixed> $ufGroupParams = [] ]) : mixed
Parameters
$joinParams : array<string|int, mixed>

Must contain entity_id at minimum.

$ufGroupParams : array<string|int, mixed> = []

createLinkCustomField()

Create a custom text fields.

protected createLinkCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

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

createMoneyTextCustomField()

Create a custom field of type money.

protected createMoneyTextCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createMultiCountryCustomField()

Create a custom multi select country fields.

protected createMultiCountryCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createMultipleMembershipOrder()

Create an order with more than one membership.

protected createMultipleMembershipOrder() : mixed
Tags
throws
CRM_Core_Exception

createMultiStateCustomField()

Create a custom multi select state fields.

protected createMultiStateCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createPartiallyPaidParticipantOrder()

Add participant with contribution

protected createPartiallyPaidParticipantOrder() : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

createPriceSet()

Create price set that includes one price field with two option values.

protected createPriceSet([string $component = 'contribution_page' ][, int|null $componentID = NULL ][, array<string|int, mixed> $priceFieldOptions = [] ][, string $identifier = 'price_set_test' ]) : array<string|int, mixed>
Parameters
$component : string = 'contribution_page'
$componentID : int|null = NULL
$priceFieldOptions : array<string|int, mixed> = []
$identifier : string = 'price_set_test'
Return values
array<string|int, mixed>
  • the result of API3 PriceFieldValue.get for the new PriceField

createProfile()

Create a profile.

protected createProfile(mixed $ufGroupParams) : int
Parameters
$ufGroupParams : mixed
Return values
int

createReceiptableContributionPage()

Create a Contribution Page with is_email_receipt = TRUE.

protected createReceiptableContributionPage([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Params to overwrite with.

Return values
array<string|int, mixed>

createRuleGroup()

protected createRuleGroup() : array<string|int, mixed>|int
Return values
array<string|int, mixed>|int

createSelectCustomField()

Create custom select field.

protected createSelectCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createStateCustomField()

Create a custom state fields.

protected createStateCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

createStringCheckboxCustomField()

Create a custom field of type radio with integer values.

protected createStringCheckboxCustomField(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>
Return values
array<string|int, mixed>

createSubsequentPendingMembership()

Create a paid membership for renewal tests.

protected createSubsequentPendingMembership() : void

createTextCustomField()

Create a custom text fields.

protected createTextCustomField([array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed> = []

Parameter overrides, must include custom_group_id.

Return values
array<string|int, mixed>

disableTaxAndInvoicing()

Enable Tax and Invoicing

protected disableTaxAndInvoicing() : void

disorganizeOptionValues()

Disorganize our option values to ensure we are not relying on luck.

protected disorganizeOptionValues() : void

For example our contributions and recurring contributions use different option groups for contribution_status_id but by happy co-incidence (ahem) both have 1 for completed by default. This upsets that co-incidence for more robust testing. Ideally we would do this for all tests & for a range of values but there is too much hard-coding to roll that out right now.

Tags
noinspection

PhpUnhandledExceptionInspection

eliminateUFGroupOne()

Ensure we don't have a profile with the id or one to ensure that we are not casting an array to it.

protected eliminateUFGroupOne() : mixed

enableTaxAndInvoicing()

Enable Tax and Invoicing

protected enableTaxAndInvoicing([array<string|int, mixed> $params = [] ]) : void
Parameters
$params : array<string|int, mixed> = []

ensureMembershipPriceSetExists()

Ensure the default price set & field exist for memberships.

protected ensureMembershipPriceSetExists() : void

ensureMySQLMode()

Ensure the specified mysql mode/s are activated.

protected ensureMySQLMode(array<string|int, mixed> $modes) : void
Parameters
$modes : array<string|int, mixed>
Tags
noinspection

PhpDocMissingThrowsInspection

eventCreatePaid()

Create a paid event.

protected eventCreatePaid([array<string|int, mixed> $eventParameters = [] ][, array<string|int, mixed> $priceSetParameters = [] ][, string $identifier = 'PaidEvent' ]) : array<string|int, mixed>
Parameters
$eventParameters : array<string|int, mixed> = []

Values to

$priceSetParameters : array<string|int, mixed> = []
$identifier : string = 'PaidEvent'

Index for storing event ID in ids array.

Return values
array<string|int, mixed>

eventCreateUnpaid()

Create an unpaid event.

protected eventCreateUnpaid([array<string|int, mixed> $eventParameters = [] ][, string $identifier = 'event' ]) : array<string|int, mixed>
Parameters
$eventParameters : array<string|int, mixed> = []

Values to

$identifier : string = 'event'

Index for storing event ID in ids array.

Return values
array<string|int, mixed>

eventPriceSetCreate()

Create a price set for an event.

protected eventPriceSetCreate(float $feeTotal[, float $minAmt = 0 ][, string $type = 'Text' ][, array<string|int, mixed> $options = [['name' => 'hundred', 'amount' => 100]] ]) : int
Parameters
$feeTotal : float
$minAmt : float = 0
$type : string = 'Text'
$options : array<string|int, mixed> = [['name' => 'hundred', 'amount' => 100]]
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

Return values
int

Price Set ID.

flushFinancialTypeStatics()

Flush statics relating to financial type.

protected flushFinancialTypeStatics() : void
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

formatMoneyInput()

Format money as it would be input.

protected formatMoneyInput(string $amount) : string
Parameters
$amount : string
Return values
string

getAvailableFieldCombinations()

Get data available for custom fields.

protected getAvailableFieldCombinations() : array<string|int, mixed>

The 'default' key holds general values. Where more than one html type is an option then the any values that differ to the defaults are keyed by html key.

The order below is consistent with the UI.

Return values
array<string|int, mixed>

getContributionID()

Get the created contribution ID.

protected getContributionID([string $key = 'first' ]) : int
Parameters
$key : string = 'first'
Return values
int

getCustomFieldColumnName()

Get the the column name for the identified custom field.

protected getCustomFieldColumnName(string $key) : string
Parameters
$key : string

Identifier - generally keys map to data type - eg. 'text', 'int' etc.

Return values
string

getCustomFieldID()

Get the custom field name for the relevant key.

protected getCustomFieldID(string $key) : string

e.g returns 'custom_5' where 5 is the id of the field using the key.

Generally keys map to data types.

Parameters
$key : string
Return values
string

getCustomFieldName()

Get the custom field name for the relevant key.

protected getCustomFieldName([string $key = 'text' ][, int $version = 3 ]) : string

e.g returns 'custom_5' where 5 is the id of the field using the key.

Generally keys map to data types.

Parameters
$key : string = 'text'
$version : int = 3
Tags
noinspection

PhpDocMissingThrowsInspection

noinspection

PhpUnhandledExceptionInspection

Return values
string

getDefaultSystemLocale()

Get the default system locale.

protected getDefaultSystemLocale() : string
Return values
string

getDeprecatedProperty()

Retrieve a deprecated property, ensuring a deprecation notice is thrown.

protected getDeprecatedProperty(string $property) : mixed
Parameters
$property : string
Tags
throws
CRM_Core_Exception

getEntity()

Get the entity being acted on.

protected getEntity() : string
Return values
string

getEvent()

This retrieves the values used to create the event.

protected getEvent(string $identifier) : array<string|int, mixed>

Note this does not actually retrieve the event from the database although it arguably might be more useful.

Parameters
$identifier : string
Return values
array<string|int, mixed>

getEventExampleData()

Get example data with which to create the event.

protected getEventExampleData([string $name = 'PaidEvent' ]) : array<string|int, mixed>
Parameters
$name : string = 'PaidEvent'
Return values
array<string|int, mixed>

getEventID()

Get the event id of the event created in set up.

protected getEventID([string $identifier = 'event' ]) : int

If only one has been created it will be selected. Otherwise you should pass in the appropriate identifier.

Parameters
$identifier : string = 'event'
Return values
int

getEventValue()

Get a value from an event used in setup.

protected getEventValue(string $value, string $identifier) : mixed|null
Parameters
$value : string
$identifier : string
Return values
mixed|null

getExampleData()

Get example data.

protected getExampleData(string $entity, string $name) : array<string|int, mixed>
Parameters
$entity : string
$name : string
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

getFinancialTransactionsForContribution()

Get the financial items for the contribution.

protected getFinancialTransactionsForContribution(int $contributionID) : array<string|int, mixed>
Parameters
$contributionID : int
Return values
array<string|int, mixed>

Array of associated financial items.

getMembershipID()

Get the created contribution ID.

protected getMembershipID() : int
Return values
int

getMembershipLineItem()

protected getMembershipLineItem() : array<string|int, array<string|int, mixed>>
Tags
throws
CRM_Core_Exception
Return values
array<string|int, array<string|int, mixed>>

getOptionGroupID()

Get the option group id of the created field.

protected getOptionGroupID(string $key) : string
Parameters
$key : string
Return values
string

getOptionGroupName()

Get the option group id of the created field.

protected getOptionGroupName(string $key) : string
Parameters
$key : string
Return values
string

getParticipantOrderParams()

Get parameters to set up a multi-line participant order.

protected getParticipantOrderParams() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPriceFieldFormLabel()

Get the label for the form price field - eg price_6

protected getPriceFieldFormLabel(string $key) : string
Parameters
$key : string
Return values
string

getPriceFieldID()

Get the created price field id.

protected getPriceFieldID([string $key = 'membership' ]) : int
Parameters
$key : string = 'membership'
Return values
int

getPriceFieldLabelForContributionPage()

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
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

Return values
string

getPriceFieldOptions()

Get the options for the price set.

protected getPriceFieldOptions([string $identifier = 'PaidEvent' ]) : array<string|int, array<string|int, mixed>>
Parameters
$identifier : string = 'PaidEvent'

Optional string if we want to specify different options. This is not currently used but is consistent with our other functions and would allow over-riding.

Return values
array<string|int, array<string|int, mixed>>

getPriceSetID()

Get the created price set id.

protected getPriceSetID([string $key = 'membership' ]) : int
Parameters
$key : string = 'membership'
Return values
int

getRenderedFormContents()

Get the rendered contents from a form.

protected getRenderedFormContents(string $formName) : false|string
Parameters
$formName : string
Return values
false|string

getTablesWithData()

Get an array of tables with rows - useful for diagnosing cleanup issues.

protected getTablesWithData() : array<string|int, mixed>
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

loadXMLDataSet()

Load the data that used to be handled by the discontinued dbunit class.

protected loadXMLDataSet(string $fileName) : mixed

This could do with further tidy up - the initial priority is simply to get rid of the dbunity package which is no longer supported.

Parameters
$fileName : string

organizeOptionValues()

This undoes the `disorganizeOptionValues` function.

protected organizeOptionValues() : void
Tags
noinspection

PhpUnhandledExceptionInspection

prepareForACLs()

Prepare class for ACLs.

protected prepareForACLs() : void

renameLabels()

Rename various labels to not match the names.

protected renameLabels() : mixed

Doing these mimics the fact the name != the label in international installs & triggers failures in code that expects it to.

resetHooks()

Reset any registered hooks.

protected resetHooks() : void

resetLabels()

Undo any label renaming.

protected resetLabels() : mixed

restoreUFGroupOne()

Bring back UF group one.

protected restoreUFGroupOne() : mixed

revertSetting()

protected revertSetting(string $setting) : void
Parameters
$setting : string

revertTemplateToReservedTemplate()

Reinstate the default template.

protected revertTemplateToReservedTemplate() : void
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

runApi4LegacyChain()

protected runApi4LegacyChain(string $key, mixed $params, string $mainEntity, array<string|int, mixed> $result, bool $sequential) : array<string|int, mixed>
Parameters
$key : string
$params : mixed
$mainEntity : string
$result : array<string|int, mixed>
$sequential : bool
Tags
throws
CRM_Core_Exception
Return values
array<string|int, mixed>

runTest()

Override to run the test and assert its state.

protected runTest() : mixed
Tags
throws
Throwable

setCurrencySeparators()

Set the separators for thousands and decimal points.

protected setCurrencySeparators(string $thousandSeparator) : void

Note that this only covers some common scenarios.

Most notably it tests our legacy way of setting currency separators.

It is now preferred to use the locale instead. This test disables partial_locales in order to test our legacy method.

Parameters
$thousandSeparator : string

setDefaultCurrency()

Sets the default currency.

protected setDefaultCurrency(string $currency) : void
Parameters
$currency : string

setMonetaryDecimalPoint()

Sets the decimal separator.

protected setMonetaryDecimalPoint(string $decimalPoint) : void

If you use this function also set the thousand separator setMonetaryDecimalPoint

Parameters
$decimalPoint : string

setMonetaryThousandSeparator()

Sets the thousand separator.

protected setMonetaryThousandSeparator(mixed $thousandSeparator) : void

If you use this function also set the decimal separator: setMonetaryDecimalSeparator

Parameters
$thousandSeparator : mixed

setPermissions()

Set the permissions to the supplied array.

protected setPermissions(array<string|int, mixed> $permissions) : void
Parameters
$permissions : array<string|int, mixed>

setUpAutoRenewMembership()

Set up a basic auto-renew membership for tests.

protected setUpAutoRenewMembership([array<string|int, mixed> $generalParams = [] ][, array<string|int, mixed> $recurParams = [] ]) : array<string|int, mixed>|int
Parameters
$generalParams : array<string|int, mixed> = []

Parameters that can be merged into the recurring AND the contribution.

$recurParams : array<string|int, mixed> = []

Parameters to merge into the recur only.

Return values
array<string|int, mixed>|int

setUpForCompleteTransaction()

Common set up routine.

protected setUpForCompleteTransaction() : array<string|int, mixed>
Return values
array<string|int, mixed>

setUpMembershipBlockPriceSet()

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.

Tags
noinspection

PhpDocMissingThrowsInspection

noinspection

PhpUnhandledExceptionInspection

setupMockHandler()

Add a mock handler to the authorize.net processor for testing.

protected setupMockHandler([int|null $id = NULL ]) : mixed
Parameters
$id : int|null = NULL
Tags
throws
CRM_Core_Exception

setUpRecurringContribution()

Set up the basic recurring contribution for tests.

protected setUpRecurringContribution([array<string|int, mixed> $generalParams = [] ][, array<string|int, mixed> $recurParams = [] ]) : array<string|int, mixed>|int
Parameters
$generalParams : array<string|int, mixed> = []

Parameters that can be merged into the recurring AND the contribution.

$recurParams : array<string|int, mixed> = []

Parameters to merge into the recur only.

Return values
array<string|int, mixed>|int

setUpRepeatTransaction()

Set up a repeat transaction.

protected setUpRepeatTransaction(array<string|int, mixed> $recurParams, string $flag[, array<string|int, mixed> $contributionParams = [] ]) : array<string|int, mixed>
Parameters
$recurParams : array<string|int, mixed>
$flag : string
$contributionParams : array<string|int, mixed> = []
Return values
array<string|int, mixed>

startCapturingOutput()

Start capturing browser output.

protected startCapturingOutput() : mixed

The starts the process of browser output being captured, setting any variables needed for e-notice prevention.

swapMessageTemplateForInput()

Replace the template with a test-oriented template designed to show all the variables.

protected swapMessageTemplateForInput(string $templateName, string $input[, string $type = 'html' ]) : void
Parameters
$templateName : string
$input : string
$type : string = 'html'
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

swapMessageTemplateForTestTemplate()

Replace the template with a test-oriented template designed to show all the variables.

protected swapMessageTemplateForTestTemplate([string $templateName = 'contribution_online_receipt' ][, string $type = 'html' ]) : void
Parameters
$templateName : string = 'contribution_online_receipt'
$type : string = 'html'
Tags
noinspection

PhpUnhandledExceptionInspection

noinspection

PhpDocMissingThrowsInspection

updateEvent()

Update an event.

protected updateEvent([array<string|int, mixed> $eventParameters = [] ][, string $identifier = 'event' ]) : void
Parameters
$eventParameters : array<string|int, mixed> = []

Values to

$identifier : string = 'event'

Index for storing event ID in ids array.

useFrozenTime()

Temporarily freeze time, as perceived through `CRM_Utils_Time`.

protected useFrozenTime() : void

_contactCreate()

Private helper function for calling civicrm_contact_add.

private _contactCreate(array<string|int, mixed> $params[, string $identifier = 'Contact' ]) : int
Parameters
$params : array<string|int, mixed>

For civicrm_contact_add api function call.

$identifier : string = 'Contact'
Return values
int

id of contact created

addProfilesToEvent()

Add profiles to the event.

private addProfilesToEvent([string $identifier = 'event' ]) : void

This function is designed to reflect the normal use case where events do have profiles.

Note if any classes do not want profiles, or want something different, the thinking is they should override this. Once that arises we can review making it protected rather than private & checking we are happy with the signature.

Parameters
$identifier : string = 'event'
Tags
throws
CRM_Core_Exception

createEventProfile()

Create a profile attached to an event.

private createEventProfile(array<string|int, mixed> $profile, string $identifier[, bool $isAdditional = FALSE ]) : void
Parameters
$profile : array<string|int, mixed>
$identifier : string
$isAdditional : bool = FALSE
Tags
throws
CRM_Core_Exception

createQuickConfigContributionPage()

Create a price set with a quick config price set.

private createQuickConfigContributionPage([array<string|int, mixed> $contributionPageParams = [] ]) : int

The params to use this look like

['price_' . $this->ids['PriceField']['basic'] => $this->ids['PriceFieldValue']['basic']]

Parameters
$contributionPageParams : array<string|int, mixed> = []
Tags
throws
CRM_Core_Exception
throws
UnauthorizedException
Return values
int

eventCreatePriceSet()

Create a price set for an event.

private eventCreatePriceSet(array<string|int, mixed> $priceSetParameters, string $identifier) : void
Parameters
$priceSetParameters : array<string|int, mixed>
$identifier : string

unsetID()

Unset the key 'id' from the array

private unsetID(array<string|int, mixed> &$unformattedArray) : void
Parameters
$unformattedArray : array<string|int, mixed>

The array from which the 'id' has to be unset.


        
On this page

Search results