public function MailChimp_ListsTest::segmentAdd in Mailchimp 7.3
See also
Mailchimp_Lists::segmentAdd()
File
- tests/
mailchimp_lists_test.inc, line 94 - A virtual MailChimp Lists API implementation for use in testing.
Class
Code
public function segmentAdd($id, $opts) {
$lists = $this
->loadLists();
$response = array();
if (isset($lists[$id])) {
$new_id = uniqid();
$new_segment = array(
'id' => $new_id,
'name' => $opts['name'],
);
if (isset($opts['segment_opts'])) {
$new_segment['segment_opts'] = $opts['segment_opts'];
}
$lists[$id]['segments'][] = $new_segment;
$response['id'] = $new_id;
}
else {
$response['status'] = 'error';
$response['code'] = 200;
$response['name'] = 'List_DoesNotExist';
}
return $response;
}