From c198e59d6859c0b3b5fdfedf54ab81d1c52b08b7 Mon Sep 17 00:00:00 2001 From: eileenmcnaugton Date: Thu, 26 Nov 2015 20:08:35 +1300 Subject: [PATCH] CRM-17519 add test for leaky smarty params (profile vars) --- .../CRM/Core/Payment/AuthorizeNetIPNTest.php | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php index aef2a788dc..ab1c8a628f 100644 --- a/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php +++ b/tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php @@ -139,6 +139,61 @@ class CRM_Core_Payment_AuthorizeNetIPNTest extends CiviUnitTestCase { $mut->clearMessages(); } + /** + * Test IPN response mails don't leak. + */ + public function testIPNPaymentMembershipRecurSuccessNoLeakageOnlineThenOffline() { + $mut = new CiviMailUtils($this, TRUE); + $this->setupMembershipRecurringPaymentProcessorTransaction(array('is_email_receipt' => TRUE)); + $this->addProfile('supporter_profile', $this->_contributionPageID); + $IPN = new CRM_Core_Payment_AuthorizeNetIPN($this->getRecurTransaction()); + $IPN->main(); + $mut->checkAllMailLog(array( + 'Membership Type: General', + 'Mr. Anthony Anderson II" ', + 'Amount: $ 200.00', + 'Membership Start Date:', + 'Supporter Profile', + 'First Name: Anthony', + 'Last Name: Anderson', + 'Email Address: anthony_anderson@civicrm.org', + 'This membership will be automatically renewed every', + 'Dear Mr. Anthony Anderson II', + 'Thanks for your auto renew membership sign-up', + )); + + $this->_contactID = $this->individualCreate(array('first_name' => 'Antonia', 'prefix_id' => 'Mrs.', 'email' => 'antonia_anderson@civicrm.org')); + $this->_invoiceID = uniqid(); + $this->_contributionPageID = NULL; + + $this->setupMembershipRecurringPaymentProcessorTransaction(array('is_email_receipt' => TRUE)); + $mut->clearMessages(99999); + $IPN = new CRM_Core_Payment_AuthorizeNetIPN($this->getRecurTransaction(array('x_trans_id' => 'hers'))); + $IPN->main(); + + $mut->checkAllMailLog(array( + 'Membership Type: General', + 'Mrs. Antonia Anderson II', + 'antonia_anderson@civicrm.org', + 'Amount: $ 200.00', + 'Membership Start Date:', + 'Transaction #: hers', + 'This membership will be automatically renewed every', + 'Dear Mrs. Antonia Anderson II', + 'Thanks for your auto renew membership sign-up', + ), array( + 'First Name: Anthony', + 'First Name: Antonia', + 'Last Name: Anderson', + 'Supporter Profile', + 'Email Address: antonia_anderson@civicrm.org', + ) + ); + + $mut->stop(); + $mut->clearMessages(); + } + /** * Get detail for recurring transaction. * -- 2.25.1