From aae2a897b818b0ca5fc0ea1ed20c4c273f8946a7 Mon Sep 17 00:00:00 2001 From: eileen Date: Sat, 16 Nov 2019 16:55:53 +1300 Subject: [PATCH] [NFC] fix test to correctly set up partially paid contribution --- tests/phpunit/CRM/Member/Form/MembershipTest.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/phpunit/CRM/Member/Form/MembershipTest.php b/tests/phpunit/CRM/Member/Form/MembershipTest.php index 6a60631c762d..4c1cfffec52d 100644 --- a/tests/phpunit/CRM/Member/Form/MembershipTest.php +++ b/tests/phpunit/CRM/Member/Form/MembershipTest.php @@ -867,6 +867,9 @@ public function testSubmitPayLaterWithBilling() { /** * Test if membership is updated to New after contribution * is updated from Partially paid to Completed. + * + * @throws \CRM_Core_Exception + * @throws \CiviCRM_API3_Exception */ public function testSubmitUpdateMembershipFromPartiallyPaid() { $memStatus = CRM_Member_BAO_Membership::buildOptions('status_id', 'validate'); @@ -878,15 +881,14 @@ public function testSubmitUpdateMembershipFromPartiallyPaid() { $contribution = $this->callAPISuccessGetSingle('MembershipPayment', [ 'membership_id' => $membership['id'], ]); - - //Update contribution to Partially paid. - $prevContribution = $this->callAPISuccess('Contribution', 'create', [ - 'id' => $contribution['contribution_id'], - 'contribution_status_id' => 'Partially paid', + $prevContribution = $this->callAPISuccessGetSingle('Contribution', ['id' => $contribution['id']]); + $this->callAPISuccess('Payment', 'create', [ + 'contribution_id' => $contribution['contribution_id'], + 'payment_instrument_id' => 'Cash', + 'total_amount' => 5, ]); - $prevContribution = $prevContribution['values'][1]; - //Complete the contribution from offline form. + // Complete the contribution from offline form. $form = new CRM_Contribute_Form_Contribution(); $submitParams = [ 'id' => $contribution['contribution_id'],