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