$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.
*/
// Verify that updated case is equal to the original with new subject.
$result = $this->callAPISuccessGetSingle('Case', array('case_id' => $id));
// Modification dates are likely to differ by 0-2 sec. Check manually.
- $this->assertGreaterThanOrEqual($result['modified_date'], $case['modified_date']);
- unset($result['modified_date']);
- unset($case['modified_date']);
+ $this->assertGreaterThanOrEqual($case['modified_date'], $result['modified_date']);
+ unset($result['modified_date'], $case['modified_date']);
// Everything else should be identical.
$this->assertAPIArrayComparison($result, $case);
}
// Verify that updated case is equal to the original with new subject.
$result = $this->callAPISuccessGetSingle('Case', array('case_id' => $id));
// Modification dates are likely to differ by 0-2 sec. Check manually.
- $this->assertGreaterThanOrEqual($result['modified_date'], $case['modified_date']);
- unset($result['modified_date']);
- unset($case['modified_date']);
+ $this->assertGreaterThanOrEqual($case['modified_date'], $result['modified_date']);
+ unset($result['modified_date'], $case['modified_date']);
// Everything else should be identical.
$this->assertAPIArrayComparison($result, $case);
}