From 9e8b2bb1a2df5806ba3e583e0c58a73ed588851e Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Mon, 15 Jun 2015 16:15:25 +1200 Subject: [PATCH] CRM-16679 fix duplicate membership regression. Test edited to avoid failing on enotice --- CRM/Member/Form/Membership.php | 2 +- tests/phpunit/CRM/Member/Form/MembershipTest.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 8d51eb4342..2939069463 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -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; } diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index 5632513b14..b89e4fdd31 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -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', -- 2.25.1