Merge pull request #520 from dlobo/CRM-12274
[civicrm-core.git] / api / v3 / examples / MailingCreate.php
CommitLineData
6a488035
TO
1<?php
2
3/*
4
5 */
6function mailing_create_example(){
7$params = array(
8 'subject' => 'maild',
9 'body_text' => 'bdkfhdskfhduew',
10 'version' => 3,
11 'name' => 'mailing name',
12 'created_id' => 1,
13);
14
15 $result = civicrm_api( 'mailing','create',$params );
16
17 return $result;
18}
19
20/*
21 * Function returns array of result expected from previous function
22 */
23function mailing_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 'domain_id' => '1',
34 'header_id' => 'null',
35 'footer_id' => 'null',
36 'reply_id' => '',
37 'unsubscribe_id' => '',
38 'resubscribe_id' => '',
39 'optout_id' => '',
40 'name' => 'mailing name',
41 'from_name' => 'FIXME',
42 'from_email' => 'info@EXAMPLE.ORG',
43 'replyto_email' => 'info@EXAMPLE.ORG',
44 'subject' => 'maild',
45 'body_text' => 'bdkfhdskfhduew',
46 'body_html' => '',
47 'url_tracking' => '1',
48 'forward_replies' => '',
49 'auto_responder' => 0,
50 'open_tracking' => '1',
51 'is_completed' => '',
52 'msg_template_id' => '',
53 'override_verp' => '1',
54 'created_id' => '1',
55 'created_date' => '20130204223402',
56 'scheduled_id' => '',
57 'scheduled_date' => '20130204223402',
58 'approver_id' => '1',
59 'approval_date' => '20130204223402',
60 'approval_status_id' => '',
61 'approval_note' => '',
62 'is_archived' => '',
63 'visibility' => 'User and User Admin Only',
64 'campaign_id' => '',
65 'dedupe_email' => '',
66 'sms_provider_id' => '',
67 'api.mailing_job.create' => array(
68 'is_error' => 0,
69 'version' => 3,
70 'count' => 1,
71 'id' => 1,
72 'values' => array(
73 '0' => array(
74 'id' => '1',
75 'mailing_id' => '1',
76 'scheduled_date' => '20130204223402',
77 'start_date' => '',
78 'end_date' => '',
79 'status' => 'Scheduled',
80 'is_test' => 0,
81 'job_type' => '',
82 'parent_id' => '',
83 'job_offset' => '',
84 'job_limit' => '',
85 ),
86 ),
87 ),
88 ),
89 ),
90);
91
92 return $expectedResult ;
93}
94
95
96/*
97* This example has been generated from the API test suite. The test that created it is called
98*
99* testMailerCreateSuccess and can be found in
100* http://svn.civicrm.org/civicrm/trunk/tests/phpunit/CiviTest/api/v3/MailingTest.php
101*
102* You can see the outcome of the API tests at
103* http://tests.dev.civicrm.org/trunk/results-api_v3
104*
105* To Learn about the API read
106* http://book.civicrm.org/developer/current/techniques/api/
107*
108* and review the wiki at
109* http://wiki.civicrm.org/confluence/display/CRMDOC/CiviCRM+Public+APIs
110*
111* Read more about testing here
112* http://wiki.civicrm.org/confluence/display/CRM/Testing
113*
114* API Standards documentation:
115* http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards
116*/