1 {literal}<?php{/literal}
8 * Test Generated example demonstrating the {$entity}.{$action} API.
10 {if !empty($result.deprecated) && is_string($result.deprecated)}
12 * {$result.deprecated}
18 {foreach from=$description item='line'}
26 function {$function}_example() {literal}{{/literal}
27 $params = {$params|@print_array};
30 $result = civicrm_api3('{$entity}', '{$action}', $params);
32 catch (CiviCRM_API3_Exception $e) {
34 $errorMessage = $e->getMessage();
35 $errorCode = $e->getErrorCode();
36 $errorData = $e->getExtraParams();
39 'error_message' => $errorMessage,
40 'error_code' => $errorCode,
41 'error_data' => $errorData,
49 * Function returns array of result expected from previous function.
54 function {$function}_expectedresult() {literal}{{/literal}
56 $expectedResult = {$result|@print_array};
58 return $expectedResult;
62 * This example has been generated from the API test suite.
63 * The test that created it is called "{$testFunction}"
64 * and can be found at:
65 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/{$testFile}
67 * You can see the outcome of the API tests at
68 * https://test.civicrm.org/job/CiviCRM-Core-Matrix/
70 * To Learn about the API read
71 * https://docs.civicrm.org/dev/en/latest/api/
73 * Browse the API on your own site with the API Explorer. It is in the main
74 * CiviCRM menu, under: Support > Development > API Explorer.
76 * Read more about testing here
77 * https://docs.civicrm.org/dev/en/latest/testing/
79 * API Standards documentation:
80 * https://docs.civicrm.org/dev/en/latest/framework/api-architecture/