3 * Test Generated example of using grant create API
6 function grant_create_example(){
9 'application_received_date' => 'now',
10 'decision_date' => 'next Monday',
11 'amount_total' => '500',
13 'rationale' => 'Just Because',
19 $result = civicrm_api3('grant', 'create', $params);
21 catch (CiviCRM_API3_Exception
$e) {
23 $errorMessage = $e->getMessage();
24 $errorCode = $e->getErrorCode();
25 $errorData = $e->getExtraParams();
26 return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData);
33 * Function returns array of result expected from previous function
35 function grant_create_expectedresult(){
37 $expectedResult = array(
46 'application_received_date' => '20130728084957',
47 'decision_date' => '20130805000000',
48 'money_transfer_date' => '',
49 'grant_due_date' => '',
50 'grant_report_received' => '',
51 'grant_type_id' => '1',
52 'amount_total' => '500',
53 'amount_requested' => '',
54 'amount_granted' => '',
56 'rationale' => 'Just Because',
58 'financial_type_id' => '',
63 return $expectedResult;
68 * This example has been generated from the API test suite. The test that created it is called
70 * testCreateGrant and can be found in
71 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/GrantTest.php
73 * You can see the outcome of the API tests at
74 * http://tests.dev.civicrm.org/trunk/results-api_v3
76 * To Learn about the API read
77 * http://book.civicrm.org/developer/current/techniques/api/
79 * and review the wiki at
80 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
82 * Read more about testing here
83 * http://wiki.civicrm.org/confluence/display/CRM/Testing
85 * API Standards documentation:
86 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards