From 140609dcff91bda79c2932ffd00d995ed7c2a5ff Mon Sep 17 00:00:00 2001 From: yashodha Date: Fri, 22 Jul 2016 12:54:11 +0530 Subject: [PATCH] CRM-18591: add test ---------------------------------------- * CRM-18591: group_type parameter ignored when using API to create group https://issues.civicrm.org/jira/browse/CRM-18591 --- tests/phpunit/api/v3/GroupTest.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/phpunit/api/v3/GroupTest.php b/tests/phpunit/api/v3/GroupTest.php index 90846bd835..d668e3e366 100644 --- a/tests/phpunit/api/v3/GroupTest.php +++ b/tests/phpunit/api/v3/GroupTest.php @@ -127,6 +127,33 @@ class api_v3_GroupTest extends CiviUnitTestCase { } } + /** + * Test Group create with Group Type + */ + public function testgroupCreateWithGroupType() { + $params = array( + 'name' => 'Test Group type', + 'title' => 'Test Group Type', + 'description' => 'Test Group with Group Type', + 'is_active' => 1, + 'visibility' => 'Public Pages', + 'group_type' => array(1, 2), + ); + + $result = $this->callAPISuccess('Group', 'create', $params); + $group = $result['values'][$result['id']]; + $this->assertEquals($group['name'], "Test Group type"); + $this->assertEquals($group['is_active'], 1); + $this->assertEquals($group['group_type'], $params['group_type']); + $this->groupDelete($result['id']); + + //assert single value for group_type + $params['group_type'] = 2; + $result = $this->callAPISuccess('Group', 'create', $params); + $group = $result["values"][$result['id']]; + $this->assertEquals($group['group_type'], array($params['group_type'])); + } + public function testGetNonExistingGroup() { $params = array(); $params['title'] = 'No such group Exist'; -- 2.25.1