From 318703a467869030965e00e4539e309a52123230 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 24 Jul 2021 09:33:40 +1200 Subject: [PATCH] [Test] Add cover for setting num_terms to 2 --- tests/phpunit/CRM/Member/Form/MembershipTest.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index a7fc936ec0b2..aaa571850a14 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -499,13 +499,11 @@ public function testSubmit(string $thousandSeparator): void { 'cid' => $this->_individualId, 'contact_id' => $this->_individualId, 'join_date' => date('Y-m-d'), - 'start_date' => '', - 'end_date' => '', // This format reflects the organisation & then the type. 'membership_type_id' => [$this->ids['contact']['organization'], $this->ids['membership_type']['AnnualFixed']], 'auto_renew' => '0', 'max_related' => '', - 'num_terms' => '1', + 'num_terms' => 2, 'source' => '', 'total_amount' => $this->formatMoneyInput(1234.56), //Member dues, see data.xml @@ -522,7 +520,7 @@ public function testSubmit(string $thousandSeparator): void { ], 'credit_card_type' => 'Visa', 'billing_first_name' => 'Test', - 'billing_middlename' => 'Last', + 'billing_last_name' => 'Last', 'billing_street_address-5' => '10 Test St', 'billing_city-5' => 'Test', 'billing_state_province_id-5' => '1003', @@ -534,6 +532,7 @@ public function testSubmit(string $thousandSeparator): void { $form->_contactID = $this->_individualId; $form->testSubmit($params); $membership = $this->callAPISuccessGetSingle('Membership', ['contact_id' => $this->_individualId]); + $this->assertEquals(date('Y') + 1 . '-12-31', $membership['end_date']); $this->callAPISuccessGetCount('ContributionRecur', ['contact_id' => $this->_individualId], 0); $contribution = $this->callAPISuccess('Contribution', 'get', [ 'contact_id' => $this->_individualId, @@ -541,11 +540,10 @@ public function testSubmit(string $thousandSeparator): void { ]); //CRM-20264 : Check that CC type and number (last 4 digit) is stored during backoffice membership payment - $lastFinancialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnId($contribution['id'], 'DESC'); $financialTrxn = $this->callAPISuccessGetSingle( - 'FinancialTrxn', + 'Payment', [ - 'id' => $lastFinancialTrxnId['financialTrxnId'], + 'contribution_id' => $contribution['id'], 'return' => ['card_type_id', 'pan_truncation'], ] ); @@ -574,7 +572,7 @@ public function testSubmit(string $thousandSeparator): void { $this->mut->stop(); $this->assertEquals([ [ - 'text' => 'AnnualFixed membership for Mr. Anthony Anderson II has been added. The new membership End Date is December 31st, ' . date('Y') . '. A membership confirmation and receipt has been sent to anthony_anderson@civicrm.org.', + 'text' => 'AnnualFixed membership for Mr. Anthony Anderson II has been added. The new membership End Date is December 31st, ' . (date('Y') + 1) . '. A membership confirmation and receipt has been sent to anthony_anderson@civicrm.org.', 'title' => 'Complete', 'type' => 'success', 'options' => NULL,