$this->revertTemplateToReservedTemplate();
}
+ /**
+ * Test to ensure mail is sent on chosing pay later
+ */
+ public function testpayLater() {
+ $mut = new CiviMailUtils($this, TRUE);
+ $this->swapMessageTemplateForTestTemplate();
+ $this->createLoggedInUser();
+
+ // create contribution page first
+ $contributionPageParams = array(
+ 'title' => 'Help Support CiviCRM!',
+ 'financial_type_id' => 1,
+ 'is_monetary' => TRUE,
+ 'is_pay_later' => 1,
+ 'is_quick_config' => TRUE,
+ 'pay_later_text' => 'I will send payment by check',
+ 'pay_later_receipt' => 'This is a pay later reciept',
+ 'is_allow_other_amount' => 1,
+ 'min_amount' => 10.00,
+ 'max_amount' => 10000.00,
+ 'goal_amount' => 100000.00,
+ 'is_email_receipt' => 1,
+ 'is_active' => 1,
+ 'amount_block_is_active' => 1,
+ 'currency' => 'USD',
+ 'is_billing_required' => 0,
+ );
+ $contributionPageResult = $this->callAPISuccess('contribution_page', 'create', $contributionPageParams);
+
+ // submit form values
+ $priceSet = $this->callAPISuccess('price_set', 'getsingle', array('name' => 'default_contribution_amount'));
+ $params = array(
+ 'id' => $contributionPageResult['id'],
+ 'contact_id' => $this->_individualId,
+ 'email-5' => 'anthony_anderson@civicrm.org',
+ 'payment_processor_id' => 0,
+ 'amount' => 100.00,
+ 'tax_amount' => '',
+ 'currencyID' => 'USD',
+ 'is_pay_later' => 1,
+ 'invoiceID' => 'f28e1ddc86f8c4a0ff5bcf46393e4bc8',
+ 'is_quick_config' => 1,
+ 'description' => 'Online Contribution: Help Support CiviCRM!',
+ 'price_set_id' => $priceSet['id'],
+ );
+ $this->callAPISuccess('contribution_page', 'submit', $params);
+
+ $mut->checkMailLog(array(
+ 'is_pay_later:::1',
+ 'email:::anthony_anderson@civicrm.org',
+ 'pay_later_receipt:::' . $contributionPageParams['pay_later_receipt'],
+ 'displayName:::Mr. Anthony Anderson II',
+ 'contributionPageId:::' . $contributionPageResult['id'],
+ 'title:::' . $contributionPageParams['title'],
+ ));
+ $mut->stop();
+ $this->revertTemplateToReservedTemplate();
+ }
+
+
/**
* Test to check whether contact billing address is used when no contribution address
*/