From ee1f482b784734057288eb91f300561d7266d92c Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 20 Jan 2016 16:43:29 +0530 Subject: [PATCH] CRM-16259, added api test for delete action ---------------------------------------- * CRM-16259: Create Payment API https://issues.civicrm.org/jira/browse/CRM-16259 --- tests/phpunit/api/v3/PaymentTest.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) 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'], + )); + } + } -- 2.25.1