$params['case_type'] = $this->caseType;
$result = $this->callAPISuccess('case', 'create', $params);
$id = $result['id'];
- $result = $this->callAPISuccess('case', 'get', array('id' => $id));
- $case = $result['values'][$id];
+ $case = $this->callAPISuccess('case', 'getsingle', array('id' => $id));
// Update Case.
$params = array('id' => $id);
- $params['subject'] = $case['subject'] = 'Something Else';
+ $params['subject'] = $case['subject'] = $case['case_subject'] = 'Something Else';
$this->callAPISuccess('case', 'create', $params);
// Verify that updated case is exactly equal to the original with new subject.
- $result = $this->callAPISuccess('case', 'get', array('case_id' => $id));
- $this->assertEquals($result['values'][$id], $case);
+ $result = $this->callAPISuccess('case', 'getsingle', array('case_id' => $id));
+ $this->assertAPIArrayComparison($result, $case);
}
/**
$id = $result['id'];
// Check result - we should get a list of activity ids
- $result = $this->callAPISuccess('case', 'get', array('id' => $id));
+ $result = $this->callAPISuccess('case', 'get', array('id' => $id, 'return' => 'activities'));
$case = $result['values'][$id];
$activity = $case['activities'][0];
// Fetch case based on an activity id
$result = $this->callAPISuccess('case', 'get', array(
'activity_id' => $activity,
- 'return' => 'activities,contacts',
+ 'return' => 'activities',
));
$this->assertEquals(FALSE, empty($result['values'][$id]));
$this->assertEquals($result['values'][$id], $case);
$id = $result['id'];
// Store result for later
- $case = $this->callAPISuccess('case', 'getsingle', array('id' => $id));
+ $case = $this->callAPISuccess('case', 'getsingle', array('id' => $id, 'return' => array('activities', 'contacts')));
// Fetch case based on client contact id
$result = $this->callAPISuccess('case', 'get', array(
$id = $result['id'];
// Store result for later
- $case = $this->callAPISuccess('case', 'getsingle', array('id' => $id));
+ $case = $this->callAPISuccess('case', 'getsingle', array('id' => $id, 'return' => 'subject'));
// Fetch case based on client contact id
$result = $this->callAPISuccess('case', 'get', array(
'subject' => $this->_params['subject'],
- 'return' => array('activities', 'contacts'),
+ 'return' => array('subject'),
));
$this->assertAPIArrayComparison($result['values'][$id], $case);
}
$id = $result['id'];
// Store result for later
- $case = $this->callAPISuccess('case', 'getsingle', array('id' => $id));
+ $case = $this->callAPISuccess('case', 'getsingle', array('id' => $id, 'return' => 'contact_id'));
- $result = $this->callAPISuccess('case', 'get', array('return' => array('activities', 'contacts')));
+ $result = $this->callAPISuccess('case', 'get', array('limit' => 0, 'return' => array('contact_id')));
$this->assertAPIArrayComparison($result['values'][$id], $case);
}