Disable recipient estimation on mailings
[civicrm-core.git] / tests / templates / documentFunction.tpl
CommitLineData
6a488035 1{literal}<?php{/literal}
923d8900
SL
2
3/**
4 * @file
5 */
6
0c13f046 7/**
a828d7b8 8 * Test Generated example demonstrating the {$entity}.{$action} API.
0c13f046 9 *
a6ec24c4
CW
10{if !empty($result.deprecated) && is_string($result.deprecated)}
11 * @deprecated
12 * {$result.deprecated}
13{if !$description}
14 *
15{/if}
16{/if}
0c13f046 17{if $description}
5c49fee0
CW
18{foreach from=$description item='line'}
19 * {$line}
20{/foreach}
947a37b4 21 *
7aaa05d2 22{/if}
0c13f046
EM
23 * @return array
24 * API result array
6a488035 25 */
0c13f046
EM
26function {$function}_example() {literal}{{/literal}
27 $params = {$params|@print_array};
947a37b4 28{literal}
923d8900 29 try {{/literal}
a828d7b8 30 $result = civicrm_api3('{$entity}', '{$action}', $params);
0c13f046
EM
31{literal} }
32 catch (CiviCRM_API3_Exception $e) {
33 // Handle error here.
34 $errorMessage = $e->getMessage();
35 $errorCode = $e->getErrorCode();
36 $errorData = $e->getExtraParams();
8390b11b 37 return [
b5541920
MM
38 'is_error' => 1,
39 'error_message' => $errorMessage,
0c13f046
EM
40 'error_code' => $errorCode,
41 'error_data' => $errorData,
8390b11b 42 ];
0c13f046 43 }{/literal}
947a37b4 44
0c13f046 45 return $result;
6a488035
TO
46{literal}}{/literal}
47
947a37b4 48/**
0c13f046
EM
49 * Function returns array of result expected from previous function.
50 *
51 * @return array
52 * API result array
6a488035 53 */
0c13f046 54function {$function}_expectedresult() {literal}{{/literal}
6a488035
TO
55
56 $expectedResult = {$result|@print_array};
57
947a37b4 58 return $expectedResult;
6a488035
TO
59{literal}}{/literal}
60
a828d7b8 61/*
923d8900
SL
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}
66 *
67 * You can see the outcome of the API tests at
68 * https://test.civicrm.org/job/CiviCRM-Core-Matrix/
69 *
70 * To Learn about the API read
71 * https://docs.civicrm.org/dev/en/latest/api/
72 *
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.
75 *
76 * Read more about testing here
77 * https://docs.civicrm.org/dev/en/latest/testing/
78 *
79 * API Standards documentation:
80 * https://docs.civicrm.org/dev/en/latest/framework/api-architecture/
81 */