CRM-18303 follow up - add test for membership form (#8120)
authorEileen McNaughton <eileen@mcnaughty.com>
Tue, 12 Apr 2016 14:15:35 +0000 (02:15 +1200)
committerEileen McNaughton <eileen@mcnaughty.com>
Tue, 12 Apr 2016 14:15:35 +0000 (02:15 +1200)
tests/phpunit/CRM/Member/Form/MembershipTest.php

index 176377a1f6d2495b3e6d2877543421724d751b1d..f3bc8d4f2f2b3ee9fbf93bdd52cbd597fdb0acd6 100644 (file)
@@ -81,6 +81,11 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
    */
   protected $paymentInstruments = array();
 
+  /**
+   * @var CiviMailUtils
+   */
+  protected $mut;
+
   /**
    * Test setup for every test.
    *
@@ -426,6 +431,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
    */
   public function testSubmit() {
     $form = $this->getForm();
+    $this->mut = new CiviMailUtils($this, TRUE);
     $form->_mode = 'test';
     $this->createLoggedInUser();
     $params = array(
@@ -444,7 +450,6 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
       'soft_credit_type_id' => '',
       'soft_credit_contact_id' => '',
       'from_email_address' => '"Demonstrators Anonymous" <info@example.org>',
-      'receipt_text_signup' => 'Thank you text',
       'payment_processor_id' => $this->_paymentProcessorID,
       'credit_card_number' => '4111111111111111',
       'cvv2' => '123',
@@ -460,6 +465,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
       'billing_state_province_id-5' => '1003',
       'billing_postal_code-5' => '90210',
       'billing_country_id-5' => '1228',
+      'send_receipt' => TRUE,
+      'receipt_text' => 'Receipt text',
     );
     $form->_contactID = $this->_individualId;
     $form->testSubmit($params);
@@ -475,6 +482,11 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
       'entity_table' => 'civicrm_membership',
       'contribution_id' => $contribution['id'],
     ), 1);
+    $this->mut->checkMailLog(array(
+      '50',
+      'Receipt text',
+    ));
+    $this->mut->stop();
   }
 
   /**