From 0445e085285657ef1398d8be2a57584df3826771 Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Tue, 22 Nov 2016 17:30:34 +0530 Subject: [PATCH] Extend Unit test to assert membership renewal activity --- tests/phpunit/api/v3/ContributionTest.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/api/v3/ContributionTest.php b/tests/phpunit/api/v3/ContributionTest.php index 573c7595a9..27d5acbe16 100644 --- a/tests/phpunit/api/v3/ContributionTest.php +++ b/tests/phpunit/api/v3/ContributionTest.php @@ -2471,7 +2471,7 @@ class api_v3_ContributionTest extends CiviUnitTestCase { )); $this->assertEquals(1, $logs['count']); $this->assertEquals($stateOfGrace, $membership['status_id']); - $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution'])); + $contribution = $this->callAPISuccess('contribution', 'completetransaction', array('id' => $this->_ids['contribution'])); $membership = $this->callAPISuccess('membership', 'getsingle', array('id' => $this->_ids['membership'])); $this->assertEquals(date('Y-m-d', strtotime('yesterday + 1 year')), $membership['end_date']); $this->callAPISuccessGetSingle('LineItem', array( @@ -2481,6 +2481,12 @@ class api_v3_ContributionTest extends CiviUnitTestCase { $logs = $this->callAPISuccess('MembershipLog', 'get', array( 'membership_id' => $this->_ids['membership'], )); + //CRM-19600: Ensure that 'Membership Renewal' activity is created after successful membership regsitration + $activity = $this->callAPISuccess('Activity', 'get', array( + 'activity_type_id' => 'Membership Renewal', + 'source_record_id' => $contribution['id'], + )); + $this->assertEquals(1, $activity['count']); $this->assertEquals(2, $logs['count']); $this->assertNotEquals($stateOfGrace, $logs['values'][2]['status_id']); $this->cleanUpAfterPriceSets(); -- 2.25.1