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'],