From: Pradeep Nayak Date: Wed, 20 Jan 2016 11:13:29 +0000 (+0530) Subject: CRM-16259, added api test for delete action X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=ee1f482b784734057288eb91f300561d7266d92c;p=civicrm-core.git CRM-16259, added api test for delete action ---------------------------------------- * CRM-16259: Create Payment API https://issues.civicrm.org/jira/browse/CRM-16259 --- diff --git a/tests/phpunit/api/v3/PaymentTest.php b/tests/phpunit/api/v3/PaymentTest.php index da05c3b20d..315d392941 100644 --- a/tests/phpunit/api/v3/PaymentTest.php +++ b/tests/phpunit/api/v3/PaymentTest.php @@ -345,4 +345,30 @@ class api_v3_PaymentTest extends CiviUnitTestCase { )); } + /** + * Test delete payment api + */ + public function testDeletePayment() { + list($lineItems, $contribution) = $this->createParticipantWithContribution(); + + $params = array( + 'contribution_id' => $contribution['id'], + ); + + $payment = $this->callAPIAndDocument('payment', 'get', $params, __FUNCTION__, __FILE__); + $this->assertEquals(1, $payment['count']); + + $cancelParams = array( + 'id' => $payment['id'], + ); + $this->callAPIAndDocument('payment', 'delete', $cancelParams, __FUNCTION__, __FILE__); + + $payment = $this->callAPIAndDocument('payment', 'get', $params, __FUNCTION__, __FILE__); + $this->assertEquals(0, $payment['count']); + + $this->callAPISuccess('Contribution', 'Delete', array( + 'id' => $contribution['id'], + )); + } + }