CRM-16679 fix duplicate membership regression. Test edited to avoid failing on enotice
authorEileen McNaughton <eileen@fuzion.co.nz>
Mon, 15 Jun 2015 04:15:25 +0000 (16:15 +1200)
committerEileen McNaughton <eileen@fuzion.co.nz>
Mon, 15 Jun 2015 04:20:05 +0000 (16:20 +1200)
CRM/Member/Form/Membership.php
tests/phpunit/CRM/Member/Form/MembershipTest.php

index 8d51eb4342f3d556fbb75074c2fdb85af896b2b7..29390694631fcf64e76b857e0554d0f8438cd2d4 100644 (file)
@@ -133,7 +133,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form {
       }
     }
     else {
-      $memTypeSelected = $params['membership_type_id'];
+      $memTypeSelected = array($params['membership_type_id'][1] => $params['membership_type_id'][1]);
     }
     return $memTypeSelected;
   }
index 5632513b1456dc2b75b6a0a3cd98d5d925f98ddd..b89e4fdd31eaf7e3a43cdde68475303e5aedf548 100644 (file)
@@ -136,7 +136,7 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
   public function testFormRuleEmptyContact() {
     $params = array(
       'contact_select_id' => 0,
-      'membership_type_id' => array(),
+      'membership_type_id' => array(1 => NULL),
     );
     $files = array();
     $obj = new CRM_Member_Form_Membership();
@@ -425,7 +425,8 @@ class CRM_Member_Form_MembershipTest extends CiviUnitTestCase {
       'join_date' => date('m/d/Y', time()),
       'start_date' => '',
       'end_date' => '',
-      'membership_type_id' => array('25'),
+      // This format reflects the 1 being the organisation & the 25 being the type.
+      'membership_type_id' => array(1, 25),
       'auto_renew' => '0',
       'max_related' => '',
       'num_terms' => '1',