CRM-17519 add test for leaky smarty params (profile vars)
authoreileenmcnaugton <eileen@fuzion.co.nz>
Thu, 26 Nov 2015 07:08:35 +0000 (20:08 +1300)
committereileenmcnaugton <eileen@fuzion.co.nz>
Thu, 26 Nov 2015 20:36:56 +0000 (09:36 +1300)
tests/phpunit/CRM/Core/Payment/AuthorizeNetIPNTest.php

index aef2a788dca0bec886aa07f7d6ea73b71cf93ff2..ab1c8a628ff38a3934276995913c964b8e2f8e11 100644 (file)
@@ -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" <anthony_anderson@civicrm.org>',
+      '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.
    *