Skip to content

Commit

Permalink
Merge pull request #15867 from eileenmcnaughton/test_dumber
Browse files Browse the repository at this point in the history
[NFC] fix test to correctly set up partially paid contribution
  • Loading branch information
seamuslee001 authored Nov 17, 2019
2 parents 32815ea + aae2a89 commit eda8212
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions tests/phpunit/CRM/Member/Form/MembershipTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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'],
Expand Down

0 comments on commit eda8212

Please sign in to comment.