Merge pull request #1214 from davecivicrm/CRM-12788
[civicrm-core.git] / api / v3 / examples / AddressCreate.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4
5 */
6function address_create_example(){
edb0d67a 7$params = array(
6a488035
TO
8 'contact_id' => 3,
9 'location_type_id' => 6,
10 'street_name' => 'Ambachtstraat',
11 'street_number' => '23',
12 'street_address' => 'Ambachtstraat 23',
13 'postal_code' => '6971 BN',
14 'country_id' => '1152',
15 'city' => 'Brummen',
16 'is_primary' => 1,
17 'version' => 3,
18);
19
20 $result = civicrm_api( 'address','create',$params );
21
22 return $result;
23}
24
25/*
26 * Function returns array of result expected from previous function
27 */
28function address_create_expectedresult(){
29
edb0d67a 30 $expectedResult = array(
6a488035
TO
31 'is_error' => 0,
32 'version' => 3,
33 'count' => 1,
34 'id' => 2,
edb0d67a 35 'values' => array(
36 '2' => array(
6a488035
TO
37 'id' => '2',
38 'contact_id' => '3',
39 'location_type_id' => '6',
40 'is_primary' => '1',
41 'is_billing' => 0,
42 'street_address' => 'Ambachtstraat 23',
43 'street_number' => '23',
44 'street_name' => 'Ambachtstraat',
45 'city' => 'Brummen',
46 'postal_code' => '6971 BN',
47 'country_id' => '1152',
48 'manual_geo_code' => 0,
49 ),
50 ),
51);
52
53 return $expectedResult ;
54}
55
56
57/*
58* This example has been generated from the API test suite. The test that created it is called
59*
60* testCreateAddress and can be found in
61* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/AddressTest.php
62*
63* You can see the outcome of the API tests at
64* http://tests.dev.civicrm.org/trunk/results-api_v3
65*
66* To Learn about the API read
67* http://book.civicrm.org/developer/current/techniques/api/
68*
69* and review the wiki at
70* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
71*
72* Read more about testing here
73* http://wiki.civicrm.org/confluence/display/CRM/Testing
74*
75* API Standards documentation:
76* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
77*/