Commit | Line | Data |
---|---|---|
6a488035 | 1 | <?php |
fb32de45 | 2 | /** |
3 | * Test Generated example of using participant_status_type get API | |
4 | * * | |
6a488035 TO |
5 | */ |
6 | function participant_status_type_get_example(){ | |
53ca8fd7 | 7 | $params = array( |
6a488035 TO |
8 | 'name' => 'test status', |
9 | 'label' => 'I am a test', | |
10 | 'class' => 'Positive', | |
11 | 'is_reserved' => 0, | |
12 | 'is_active' => 1, | |
13 | 'is_counted' => 1, | |
14 | 'visibility_id' => 1, | |
15 | 'weight' => 10, | |
16 | ); | |
17 | ||
fb32de45 | 18 | try{ |
19 | $result = civicrm_api3('participant_status_type', 'get', $params); | |
20 | } | |
21 | catch (CiviCRM_API3_Exception $e) { | |
22 | // handle error here | |
23 | $errorMessage = $e->getMessage(); | |
24 | $errorCode = $e->getErrorCode(); | |
25 | $errorData = $e->getExtraParams(); | |
26 | return array('error' => $errorMessage, 'error_code' => $errorCode, 'error_data' => $errorData); | |
27 | } | |
6a488035 | 28 | |
fb32de45 | 29 | return $result; |
6a488035 TO |
30 | } |
31 | ||
fb32de45 | 32 | /** |
6a488035 TO |
33 | * Function returns array of result expected from previous function |
34 | */ | |
35 | function participant_status_type_get_expectedresult(){ | |
36 | ||
53ca8fd7 | 37 | $expectedResult = array( |
6a488035 TO |
38 | 'is_error' => 0, |
39 | 'version' => 3, | |
40 | 'count' => 1, | |
41 | 'id' => 14, | |
53ca8fd7 | 42 | 'values' => array( |
43 | '14' => array( | |
6a488035 TO |
44 | 'id' => '14', |
45 | 'name' => 'test status', | |
46 | 'label' => 'I am a test', | |
47 | 'class' => 'Positive', | |
48 | 'is_reserved' => 0, | |
49 | 'is_active' => '1', | |
50 | 'is_counted' => '1', | |
51 | 'weight' => '10', | |
52 | 'visibility_id' => '1', | |
53 | ), | |
54 | ), | |
55 | ); | |
56 | ||
fb32de45 | 57 | return $expectedResult; |
6a488035 TO |
58 | } |
59 | ||
60 | ||
61 | /* | |
62 | * This example has been generated from the API test suite. The test that created it is called | |
63 | * | |
64 | * testGetParticipantStatusType and can be found in | |
65 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/ParticipantStatusTypeTest.php | |
66 | * | |
67 | * You can see the outcome of the API tests at | |
68 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
69 | * | |
70 | * To Learn about the API read | |
71 | * http://book.civicrm.org/developer/current/techniques/api/ | |
72 | * | |
73 | * and review the wiki at | |
74 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
75 | * | |
76 | * Read more about testing here | |
77 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
78 | * | |
79 | * API Standards documentation: | |
80 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
b259a4ab | 81 | */ |