Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | ||
3 | /* | |
4 | Create a campaign - Note use of relative dates here http://www.php.net/manual/en/datetime.formats.relative.php | |
5 | */ | |
6 | function campaign_create_example(){ | |
7 | $params = array( | |
8 | 'version' => 3, | |
9 | 'title' => 'campaign title', | |
10 | 'description' => 'Call people, ask for money', | |
11 | 'created_date' => 'first sat of July 2008', | |
12 | ); | |
13 | ||
14 | $result = civicrm_api( 'campaign','create',$params ); | |
15 | ||
16 | return $result; | |
17 | } | |
18 | ||
19 | /* | |
20 | * Function returns array of result expected from previous function | |
21 | */ | |
22 | function campaign_create_expectedresult(){ | |
23 | ||
24 | $expectedResult = array( | |
25 | 'is_error' => 0, | |
26 | 'version' => 3, | |
27 | 'count' => 1, | |
28 | 'id' => 1, | |
29 | 'values' => array( | |
30 | '1' => array( | |
31 | 'id' => '1', | |
32 | 'name' => 'campaign_title', | |
33 | 'title' => 'campaign title', | |
34 | 'description' => 'Call people, ask for money', | |
35 | 'start_date' => '', | |
36 | 'end_date' => '', | |
37 | 'campaign_type_id' => '', | |
38 | 'status_id' => '', | |
39 | 'external_identifier' => '', | |
40 | 'parent_id' => '', | |
41 | 'is_active' => '', | |
42 | 'created_id' => '', | |
43 | 'created_date' => '20080705000000', | |
44 | 'last_modified_id' => '', | |
45 | 'last_modified_date' => '', | |
46 | 'goal_general' => '', | |
47 | 'goal_revenue' => '', | |
48 | ), | |
49 | ), | |
50 | ); | |
51 | ||
52 | return $expectedResult ; | |
53 | } | |
54 | ||
55 | ||
56 | /* | |
57 | * This example has been generated from the API test suite. The test that created it is called | |
58 | * | |
59 | * testCreateCampaign and can be found in | |
60 | * http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/CampaignTest.php | |
61 | * | |
62 | * You can see the outcome of the API tests at | |
63 | * http://tests.dev.civicrm.org/trunk/results-api_v3 | |
64 | * | |
65 | * To Learn about the API read | |
66 | * http://book.civicrm.org/developer/current/techniques/api/ | |
67 | * | |
68 | * and review the wiki at | |
69 | * http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs | |
70 | * | |
71 | * Read more about testing here | |
72 | * http://wiki.civicrm.org/confluence/display/CRM/Testing | |
73 | * | |
74 | * API Standards documentation: | |
75 | * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards | |
76 | */ |