From e2ca457dc00d4e8edbcc0542f52a858c317c2ea8 Mon Sep 17 00:00:00 2001 From: Karin Gerritsen Date: Wed, 16 Nov 2016 13:38:08 -0700 Subject: [PATCH] Test for https://github.com/civicrm/civicrm-core/pull/9353 --- tests/phpunit/api/v3/ContributionTest.php | 30 ++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 692748e417..dc9375385e 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -2262,7 +2262,35 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $this->revertTemplateToReservedTemplate(); } - + /** + * CRM-1960 - Test to ensure that completetransaction respects the is_email_receipt setting + */ + public function testCompleteTransactionWithEmailReceiptInput() { + // Create a Contribution Page with is_email_receipt = TRUE + $contributionPage = $this->callAPISuccess('ContributionPage', 'create', array( + 'receipt_from_name' => 'Mickey Mouse', + 'receipt_from_email' => 'mickey@mouse.com', + 'title' => "Test Contribution Page", + 'financial_type_id' => 1, + 'currency' => 'CAD', + 'is_monetary' => TRUE, + 'is_email_receipt' => TRUE, + )); + $this->_params['contribution_page_id'] = $contributionPage['id']; + $params = array_merge($this->_params, array('contribution_status_id' => 2)); + $contribution = $this->callAPISuccess('contribution', 'create', $params); + // Complete the transaction overriding is_email_receipt to = FALSE + $this->callAPISuccess('contribution', 'completetransaction', array( + 'id' => $contribution['id'], + 'trxn_date' => date('2011-04-09'), + 'trxn_id' => 'kazam', + 'is_email_receipt' => 0, + )); + // Check if a receipt was issued + $receipt_date = $this->callAPISuccess('Contribution', 'getvalue', array('id' => $contribution['id'], 'return' => 'receipt_date')); + $this->assertEquals('', $receipt_date); + } + /** * Complete the transaction using the template with all the possible. */ -- 2.25.1