3 * Test Generated example demonstrating the Mailing.clone API.
8 function mailing_clone_example() {
14 $result = civicrm_api3('Mailing', 'clone', $params);
16 catch (CiviCRM_API3_Exception
$e) {
18 $errorMessage = $e->getMessage();
19 $errorCode = $e->getErrorCode();
20 $errorData = $e->getExtraParams();
23 'error_message' => $errorMessage,
24 'error_code' => $errorCode,
25 'error_data' => $errorData,
33 * Function returns array of result expected from previous function.
38 function mailing_clone_expectedresult() {
40 $expectedResult = array(
52 'unsubscribe_id' => '5',
53 'resubscribe_id' => '6',
55 'name' => 'mailing name',
56 'mailing_type' => 'standalone',
57 'from_name' => 'FIXME',
58 'from_email' => 'info@EXAMPLE.ORG',
59 'replyto_email' => 'info@EXAMPLE.ORG',
60 'template_type' => 'traditional',
61 'template_options' => '',
62 'subject' => 'Hello {contact.display_name}',
63 'body_text' => 'This is {contact.display_name}.
65 {domain.address}{action.optOutUrl}',
66 'body_html' => '<p>This is {contact.display_name}.</p><p><a href=\'https://civicrm.org/\'>CiviCRM.org</a></p><p>{domain.address}{action.optOutUrl}</p>',
67 'url_tracking' => '1',
68 'forward_replies' => 0,
69 'auto_responder' => 0,
70 'open_tracking' => '1',
72 'msg_template_id' => '',
73 'override_verp' => '1',
74 'created_id' => '147',
75 'created_date' => '2013-07-28 08:49:19',
77 'scheduled_date' => '',
79 'approval_date' => '',
80 'approval_status_id' => '',
81 'approval_note' => '',
83 'visibility' => 'Public Pages',
85 'dedupe_email' => '1',
86 'sms_provider_id' => '',
88 'location_type_id' => '',
89 'email_selection_method' => 'automatic',
95 return $expectedResult;
99 * This example has been generated from the API test suite.
100 * The test that created it is called "testClone"
101 * and can be found at:
102 * https://github.com/civicrm/civicrm-core/blob/master/tests/phpunit/api/v3/MailingTest.php
104 * You can see the outcome of the API tests at
105 * https://test.civicrm.org/job/CiviCRM-master-git/
107 * To Learn about the API read
108 * http://wiki.civicrm.org/confluence/display/CRMDOC/Using+the+API
110 * Browse the api on your own site with the api explorer
111 * http://MYSITE.ORG/path/to/civicrm/api
113 * Read more about testing here
114 * http://wiki.civicrm.org/confluence/display/CRM/Testing
116 * API Standards documentation:
117 * http://wiki.civicrm.org/confluence/display/CRM/API+Architecture+Standards