3 * Test Generated example of using case create API
6 function case_create_example(){
8 'subject' => 'Test case',
10 'case_type' => 'housing_support',
14 $result = civicrm_api3('case', 'create', $params);
16 catch (CiviCRM_API3_Exception
$e) {
18 $errorMessage = $e->getMessage();
19 $errorCode = $e->getErrorCode();
20 $errorData = $e->getExtraParams();
21 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
28 * Function returns array of result expected from previous function
30 function case_create_expectedresult(){
32 $expectedResult = array(
40 'case_type_id' => '1',
41 'subject' => 'Test case',
42 'start_date' => '2013-07-29 00:00:00',
51 return $expectedResult;
56 * This example has been generated from the API test suite. The test that created it is called
58 * testCaseCreate and can be found in
59 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/CaseTest.php
61 * You can see the outcome of the API tests at
62 * https://test.civicrm.org/job/CiviCRM-master-git/
64 * To Learn about the API read
65 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
67 * Browse the api on your own site with the api explorer
68 * http://MYSITE.ORG/path/to/civicrm/api/explorer
70 * Read more about testing here
71 * http://wiki.civicrm.org/confluence/display/CRM/Testing
73 * API Standards documentation:
74 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards