useTransaction(TRUE); $this->_entity = 'im'; $this->_contactID = $this->organizationCreate(); $this->params = array( 'contact_id' => $this->_contactID, 'name' => 'My Yahoo IM Handle', 'location_type_id' => 1, 'provider_id' => 1, ); } public function testCreateIm() { $result = $this->callAPIAndDocument($this->_entity, 'create', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $this->getAndCheck($this->params, $result['id'], $this->_entity); $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); } public function testGetIm() { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $result = $this->callAPIAndDocument($this->_entity, 'get', $this->params, __FUNCTION__, __FILE__); $this->assertEquals(1, $result['count'], 'In line ' . __LINE__); $this->assertNotNull($result['values'][$result['id']]['id'], 'In line ' . __LINE__); $this->callAPISuccess($this->_entity, 'delete', array('id' => $result['id'])); } public function testDeleteIm() { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $deleteParams = array('id' => $result['id']); $result = $this->callAPIAndDocument($this->_entity, 'delete', $deleteParams, __FUNCTION__, __FILE__); $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array()); $this->assertEquals(0, $checkDeleted['count'], 'In line ' . __LINE__); } public function testDeleteImInvalid() { $result = $this->callAPISuccess($this->_entity, 'create', $this->params); $deleteParams = array('id' => 600); $result = $this->callAPIFailure($this->_entity, 'delete', $deleteParams); $checkDeleted = $this->callAPISuccess($this->_entity, 'get', array()); $this->assertEquals(1, $checkDeleted['count'], 'In line ' . __LINE__); } }