Skip to content

Commit

Permalink
test failure fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
monishdeb committed Jul 11, 2017
1 parent d8fbd79 commit 02a9c0a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/phpunit/api/v3/ContributionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,9 @@ public function testCreateUpdateContributionPaymentInstrument() {
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->assertAPISuccess($contribution);
$this->_checkFinancialTrxn($contribution, 'paymentInstrument', $instrumentId);

// cleanup - delete created payment instrument
$this->_deletedAddedPaymentInstrument();
}

/**
Expand All @@ -1173,6 +1176,9 @@ public function testCreateUpdateNegativeContributionPaymentInstrument() {
$contribution = $this->callAPISuccess('contribution', 'create', $newParams);
$this->assertAPISuccess($contribution);
$this->_checkFinancialTrxn($contribution, 'paymentInstrument', $instrumentId, array('total_amount' => '-100.00'));

// cleanup - delete created payment instrument
$this->_deletedAddedPaymentInstrument();
}

/**
Expand Down Expand Up @@ -3428,6 +3434,18 @@ public function _addPaymentInstrument() {
return $optionValue['values'][$optionValue['id']]['value'];
}

public function _deletedAddedPaymentInstrument() {
$result = $this->callAPISuccess('OptionValue', 'get', array(
'option_group_id' => 'payment_instrument',
'name' => 'Test Card',
'value' => '6',
'is_active' => 1,
));
if ($id = CRM_Utils_Array::value('id', $result)) {
$this->callAPISuccess('OptionValue', 'delete', array('id' => $id));
}
}

/**
* Set up the basic recurring contribution for tests.
*
Expand Down

0 comments on commit 02a9c0a

Please sign in to comment.