Merge pull request #1046 from colemanw/showHide
[civicrm-core.git] / api / v3 / examples / MailingGroupSubscribe.php
1 <?php
2
3 /*
4
5 */
6 function mailing_group_subscribe_example(){
7 $params = array(
8 'email' => 'test@test.test',
9 'group_id' => 2,
10 'contact_id' => 3,
11 'version' => 3,
12 'hash' => 'b15de8b64e2cec34',
13 'time_stamp' => '20101212121212',
14 );
15
16 $result = civicrm_api( 'mailing_group','subscribe',$params );
17
18 return $result;
19 }
20
21 /*
22 * Function returns array of result expected from previous function
23 */
24 function mailing_group_subscribe_expectedresult(){
25
26 $expectedResult = array(
27 'is_error' => 0,
28 'version' => 3,
29 'count' => 4,
30 'values' => array(
31 'contact_id' => '3',
32 'subscribe_id' => '1',
33 'hash' => '5b056fa32d2d56c6',
34 'is_error' => 0,
35 ),
36 );
37
38 return $expectedResult ;
39 }
40
41
42 /*
43 * This example has been generated from the API test suite. The test that created it is called
44 *
45 * testMailerGroupSubscribeGivenContactId and can be found in
46 * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/MailingGroupTest.php
47 *
48 * You can see the outcome of the API tests at
49 * http://tests.dev.civicrm.org/trunk/results-api_v3
50 *
51 * To Learn about the API read
52 * http://book.civicrm.org/developer/current/techniques/api/
53 *
54 * and review the wiki at
55 * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
56 *
57 * Read more about testing here
58 * http://wiki.civicrm.org/confluence/display/CRM/Testing
59 *
60 * API Standards documentation:
61 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
62 */