Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | Get entities and location block in 1 api call | |
5 | */ | |
6 | function loc_block_get_example(){ | |
82adafa2 | 7 | $params = array( |
6a488035 TO |
8 | 'version' => 3, |
9 | 'id' => 3, | |
10 | 'return' => 'all', | |
11 | ); | |
12 | ||
13 | $result = civicrm_api( 'loc_block','get',$params ); | |
14 | ||
15 | return $result; | |
16 | } | |
17 | ||
18 | /* | |
19 | * Function returns array of result expected from previous function | |
20 | */ | |
21 | function loc_block_get_expectedresult(){ | |
22 | ||
82adafa2 | 23 | $expectedResult = array( |
6a488035 TO |
24 | 'id' => '3', |
25 | 'address_id' => '3', | |
26 | 'email_id' => '4', | |
27 | 'phone_id' => '3', | |
28 | 'phone_2_id' => '4', | |
82adafa2 | 29 | 'address' => array( |
6a488035 TO |
30 | 'id' => '3', |
31 | 'location_type_id' => '1', | |
32 | 'is_primary' => 0, | |
33 | 'is_billing' => 0, | |
34 | 'street_address' => '987654321', | |
35 | 'manual_geo_code' => 0, | |
36 | ), | |
82adafa2 | 37 | 'email' => array( |
6a488035 TO |
38 | 'id' => '4', |
39 | 'location_type_id' => '1', | |
40 | 'email' => 'test2@loc.block', | |
41 | 'is_primary' => 0, | |
42 | 'is_billing' => 0, | |
43 | 'on_hold' => 0, | |
44 | 'is_bulkmail' => 0, | |
45 | ), | |
82adafa2 | 46 | 'phone' => array( |
6a488035 TO |
47 | 'id' => '3', |
48 | 'location_type_id' => '1', | |
49 | 'is_primary' => 0, | |
50 | 'is_billing' => 0, | |
51 | 'phone' => '987654321', | |
52 | 'phone_numeric' => '987654321', | |
53 | ), | |
82adafa2 | 54 | 'phone_2' => array( |
6a488035 TO |
55 | 'id' => '4', |
56 | 'location_type_id' => '1', | |
57 | 'is_primary' => 0, | |
58 | 'is_billing' => 0, | |
59 | 'phone' => '456-7890', | |
60 | 'phone_numeric' => '4567890', | |
61 | ), | |
62 | ); | |
63 | ||
64 | return $expectedResult ; | |
65 | } | |
66 | ||
67 | ||
68 | /* | |
69 | * This example has been generated from the API test suite. The test that created it is called | |
70 | * | |
71 | * testCreateLocBlockEntities and can be found in | |
72 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/LocBlockTest.php | |
73 | * | |
74 | * You can see the outcome of the API tests at | |
75 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
76 | * | |
77 | * To Learn about the API read | |
78 | * http://book.civicrm.org/developer/current/techniques/api/ | |
79 | * | |
80 | * and review the wiki at | |
81 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
82 | * | |
83 | * Read more about testing here | |
84 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
85 | * | |
86 | * API Standards documentation: | |
87 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
88 | */ |