Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | ||
5 | */ | |
6 | function email_replace_example(){ | |
7 | $params = array( | |
8 | 'version' => 3, | |
9 | 'contact_id' => 9, | |
10 | 'values' => array( | |
11 | '0' => array( | |
12 | 'location_type_id' => 18, | |
13 | 'email' => '1-1@example.com', | |
14 | 'is_primary' => 1, | |
15 | ), | |
16 | '1' => array( | |
17 | 'location_type_id' => 18, | |
18 | 'email' => '1-2@example.com', | |
19 | 'is_primary' => 0, | |
20 | ), | |
21 | '2' => array( | |
22 | 'location_type_id' => 18, | |
23 | 'email' => '1-3@example.com', | |
24 | 'is_primary' => 0, | |
25 | ), | |
26 | '3' => array( | |
27 | 'location_type_id' => 19, | |
28 | 'email' => '2-1@example.com', | |
29 | 'is_primary' => 0, | |
30 | ), | |
31 | '4' => array( | |
32 | 'location_type_id' => 19, | |
33 | 'email' => '2-2@example.com', | |
34 | 'is_primary' => 0, | |
35 | ), | |
36 | ), | |
37 | ); | |
38 | ||
39 | $result = civicrm_api( 'email','replace',$params ); | |
40 | ||
41 | return $result; | |
42 | } | |
43 | ||
44 | /* | |
45 | * Function returns array of result expected from previous function | |
46 | */ | |
47 | function email_replace_expectedresult(){ | |
48 | ||
49 | $expectedResult = array( | |
50 | 'is_error' => 0, | |
51 | 'version' => 3, | |
52 | 'count' => 5, | |
53 | 'values' => array( | |
54 | '12' => array( | |
55 | 'id' => '12', | |
56 | 'contact_id' => '9', | |
57 | 'location_type_id' => '18', | |
58 | 'email' => '1-1@example.com', | |
59 | 'is_primary' => '1', | |
60 | 'is_billing' => '', | |
61 | 'on_hold' => '', | |
62 | 'is_bulkmail' => '', | |
63 | 'hold_date' => '', | |
64 | 'reset_date' => '', | |
65 | 'signature_text' => '', | |
66 | 'signature_html' => '', | |
67 | ), | |
68 | '13' => array( | |
69 | 'id' => '13', | |
70 | 'contact_id' => '9', | |
71 | 'location_type_id' => '18', | |
72 | 'email' => '1-2@example.com', | |
73 | 'is_primary' => 0, | |
74 | 'is_billing' => '', | |
75 | 'on_hold' => '', | |
76 | 'is_bulkmail' => '', | |
77 | 'hold_date' => '', | |
78 | 'reset_date' => '', | |
79 | 'signature_text' => '', | |
80 | 'signature_html' => '', | |
81 | ), | |
82 | '14' => array( | |
83 | 'id' => '14', | |
84 | 'contact_id' => '9', | |
85 | 'location_type_id' => '18', | |
86 | 'email' => '1-3@example.com', | |
87 | 'is_primary' => 0, | |
88 | 'is_billing' => '', | |
89 | 'on_hold' => '', | |
90 | 'is_bulkmail' => '', | |
91 | 'hold_date' => '', | |
92 | 'reset_date' => '', | |
93 | 'signature_text' => '', | |
94 | 'signature_html' => '', | |
95 | ), | |
96 | '15' => array( | |
97 | 'id' => '15', | |
98 | 'contact_id' => '9', | |
99 | 'location_type_id' => '19', | |
100 | 'email' => '2-1@example.com', | |
101 | 'is_primary' => 0, | |
102 | 'is_billing' => '', | |
103 | 'on_hold' => '', | |
104 | 'is_bulkmail' => '', | |
105 | 'hold_date' => '', | |
106 | 'reset_date' => '', | |
107 | 'signature_text' => '', | |
108 | 'signature_html' => '', | |
109 | ), | |
110 | '16' => array( | |
111 | 'id' => '16', | |
112 | 'contact_id' => '9', | |
113 | 'location_type_id' => '19', | |
114 | 'email' => '2-2@example.com', | |
115 | 'is_primary' => 0, | |
116 | 'is_billing' => '', | |
117 | 'on_hold' => '', | |
118 | 'is_bulkmail' => '', | |
119 | 'hold_date' => '', | |
120 | 'reset_date' => '', | |
121 | 'signature_text' => '', | |
122 | 'signature_html' => '', | |
123 | ), | |
124 | ), | |
125 | ); | |
126 | ||
127 | return $expectedResult ; | |
128 | } | |
129 | ||
130 | ||
131 | /* | |
132 | * This example has been generated from the API test suite. The test that created it is called | |
133 | * | |
134 | * testReplaceEmail and can be found in | |
135 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/EmailTest.php | |
136 | * | |
137 | * You can see the outcome of the API tests at | |
138 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
139 | * | |
140 | * To Learn about the API read | |
141 | * http://book.civicrm.org/developer/current/techniques/api/ | |
142 | * | |
143 | * and review the wiki at | |
144 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
145 | * | |
146 | * Read more about testing here | |
147 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
148 | * | |
149 | * API Standards documentation: | |
150 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
151 | */ |