_apiversion = $version; $this->callAPISuccess($this->_entity, 'getsingle', array('label' => 'Manage Groups', 'domain_id' => 1)); } /** * Test get specifying parent * FIXME: Api4 */ public function testGetByParent() { // get by name $this->callAPISuccess($this->_entity, 'get', array('parentID' => 'Administer', 'domain_id' => 1)); $params = array( 'name' => 'Administer', 'domain_id' => 1, 'return' => 'id', ); $adminId = $this->callAPISuccess($this->_entity, 'getvalue', $params); $this->callAPISuccess($this->_entity, 'get', array('parentID' => $adminId, 'domain_id' => 1)); } /** * Test create function. * @param int $version * @dataProvider versionThreeAndFour */ public function testCreate($version) { $this->_apiversion = $version; $params = array('label' => 'Feed the Goats', 'domain_id' => 1); $result = $this->callAPISuccess($this->_entity, 'create', $params); $this->getAndCheck($params, $result['id'], $this->_entity, TRUE); } /** * Test create function. * @param int $version * @dataProvider versionThreeAndFour */ public function testDefaultDomain($version) { $this->_apiversion = $version; $params = array('label' => 'Herd the Cats'); $result = $this->callAPISuccess($this->_entity, 'create', $params); // Check domain_id has been set per default $params['domain_id'] = CRM_Core_Config::domainID(); $this->getAndCheck($params, $result['id'], $this->_entity, TRUE); } /** * Test delete function. * @param int $version * @dataProvider versionThreeAndFour */ public function testDelete($version) { $this->_apiversion = $version; $getParams = array( 'return' => 'id', 'options' => array('limit' => 1), ); $result = $this->callAPISuccess('Navigation', 'getvalue', $getParams); $this->callAPISuccess('Navigation', 'delete', array('id' => $result)); $this->callAPIFailure('Navigation', 'getvalue', array('id' => $result)); } }