From 85df4a81515e20dc512ad50de5ee3b7a1a31decf Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Tue, 7 Feb 2017 10:23:07 +1100 Subject: [PATCH] CRM-19979 Add test to demonstrate breakage --- tests/phpunit/api/v3/GroupContactTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tests/phpunit/api/v3/GroupContactTest.php b/tests/phpunit/api/v3/GroupContactTest.php index 3283d88b35..f32317bb76 100644 --- a/tests/phpunit/api/v3/GroupContactTest.php +++ b/tests/phpunit/api/v3/GroupContactTest.php @@ -238,6 +238,29 @@ class api_v3_GroupContactTest extends CiviUnitTestCase { $this->assertEquals($result2['total_count'], 1); } + /** + * CRM-19979 test that group cotnact delete action works when contact is in status of pendin. + */ + public function testDeleteWithPending() { + $groupId3 = $this->groupCreate(array( + 'name' => 'Test Group 3', + 'domain_id' => 1, + 'title' => 'New Test Group3 Created', + 'description' => 'New Test Group3 Created', + 'is_active' => 1, + 'visibility' => 'User and User Admin Only', + )); + $groupContactCreateParams = array( + 'contact_id' => $this->_contactId, + 'group_id' => $groupId3, + 'status' => 'Pending', + ); + $groupContact = $this->callAPISuccess('groupContact', 'create', $groupContactCreateParams); + $groupGetContact = $this->CallAPISuccess('groupContact', 'get', $groupContactCreateParams); + $this->callAPISuccess('groupContact', 'delete', array('id' => $groupGetContact['id'], 'status' => 'Removed')); + } + + /** * CRM-16945 duplicate groups are showing up when contacts are hard-added to child groups or smart groups. * -- 2.25.1