<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Test class for Group API - civicrm_group_*
*
- * @package CiviCRM_APIv3
+ * @package CiviCRM_APIv3
*/
-
class api_v3_GroupTest extends CiviUnitTestCase {
protected $_apiversion;
protected $_groupID;
- /**
- * @return array
- */
- function get_info() {
- return array(
- 'name' => 'Group Get',
- 'description' => 'Test all Group Get API methods.',
- 'group' => 'CiviCRM API Tests',
- );
- }
-
- function setUp() {
+ public function setUp() {
$this->_apiversion = 3;
parent::setUp();
$this->_groupID = $this->groupCreate();
}
- function tearDown() {
+ public function tearDown() {
$this->groupDelete($this->_groupID);
}
- function testgroupCreateNoTitle() {
+ public function testgroupCreateNoTitle() {
$params = array(
'name' => 'Test Group No title ',
'domain_id' => 1,
}
- function testGetGroupWithEmptyParams() {
+ public function testGetGroupWithEmptyParams() {
$group = $this->callAPISuccess('group', 'get', $params = array());
$group = $group["values"];
$this->assertEquals($group[$this->_groupID]['visibility'], 'Public Pages');
}
- function testGetGroupParamsWithGroupId() {
+ public function testGetGroupParamsWithGroupId() {
$params = array('id' => $this->_groupID);
$group = $this->callAPISuccess('group', 'get', $params);
}
}
- function testGetGroupParamsWithGroupName() {
+ public function testGetGroupParamsWithGroupName() {
$params = array(
'name' => "Test Group 1",
);
}
}
- function testGetGroupParamsWithReturnName() {
+ public function testGetGroupParamsWithReturnName() {
$params = array();
$params['id'] = $this->_groupID;
$params['return.name'] = 1;
);
}
- function testGetGroupParamsWithGroupTitle() {
+ public function testGetGroupParamsWithGroupTitle() {
$params = array();
$params['title'] = 'New Test Group Created';
$group = $this->callAPISuccess('group', 'get', $params);
}
}
- function testGetNonExistingGroup() {
+ public function testGetNonExistingGroup() {
$params = array();
$params['title'] = 'No such group Exist';
$group = $this->callAPISuccess('group', 'get', $params);
$this->assertEquals(0, $group['count']);
}
- function testgroupdeleteParamsnoId() {
+ public function testgroupdeleteParamsnoId() {
$group = $this->callAPIFailure('group', 'delete', array(), 'Mandatory key(s) missing from params array: id');
}
- function testgetfields() {
+ public function testgetfields() {
$description = "demonstrate use of getfields to interrogate api";
$params = array('action' => 'create');
$result = $this->callAPIAndDocument('group', 'getfields', $params, __FUNCTION__, __FILE__, $description, 'getfields', 'getfields');
$this->assertEquals(1, $result['values']['is_active']['api.default']);
}
}
-