$this->assertEquals($result['values'][$id]['subject'], $params['subject']);
}
+ /**
+ * Test create function with resolved status.
+ */
+ public function testCaseCreateWithResolvedStatus() {
+ $params = $this->_params;
+ // Test using label instead of value.
+ unset($params['case_type_id']);
+ $params['case_type'] = $this->caseType;
+ $params['status_id'] = 'Closed';
+ $result = $this->callAPISuccess('case', 'create', $params);
+ $id = $result['id'];
+
+ // Check result
+ $result = $this->callAPISuccess('case', 'get', array('id' => $id));
+ $this->assertEquals($result['values'][$id]['id'], $id);
+ $this->assertEquals($result['values'][$id]['case_type_id'], $this->caseTypeId);
+ $this->assertEquals($result['values'][$id]['subject'], $params['subject']);
+ $this->assertEquals($result['values'][$id]['end_date'], date('Y-m-d'));
+
+ //Check all relationship end dates are set to case end date.
+ $relationships = $this->callAPISuccess('Relationship', 'get', array(
+ 'sequential' => 1,
+ 'case_id' => $id,
+ ));
+ foreach ($relationships['values'] as $key => $values) {
+ $this->assertEquals($values['end_date'], date('Y-m-d'));
+ }
+ }
+
/**
* Test case create with valid parameters and custom data.
*/