MailchimpListsTest.php in Mailchimp 8
File
modules/mailchimp_lists/src/Tests/MailchimpListsTest.php
View source
<?php
namespace Drupal\Tests\mailchimp_lists\Functional;
class MailchimpListsTest extends MailchimpListsTestBase {
public static $modules = [
'mailchimp',
'mailchimp_lists',
'mailchimp_test',
];
public function testGetList() {
$list_id = '57afe96172';
$list = mailchimp_get_list($list_id);
$this
->assertEqual($list->id, $list_id);
$this
->assertEqual($list->name, 'Test List One');
}
public function testMultiListRetrieval() {
$list_ids = [
'57afe96172',
'f4b7b26b2e',
];
$lists = mailchimp_get_lists($list_ids);
$this
->assertEqual(count($lists), 2, 'Tested correct list count on retrieval.');
$this
->assertEqual($lists[$list_ids[0]]->id, $list_ids[0]);
$this
->assertEqual($lists[$list_ids[0]]->name, 'Test List One');
$this
->assertEqual($lists[$list_ids[1]]->id, $list_ids[1]);
$this
->assertEqual($lists[$list_ids[1]]->name, 'Test List Two');
}
public function testGetMergevars() {
$list_ids = [
'57afe96172',
];
$mergevars = mailchimp_get_mergevars($list_ids);
$this
->assertEqual(count($mergevars[$list_ids[0]]), 3, 'Tested correct mergevar count on retrieval.');
$this
->assertEqual($mergevars[$list_ids[0]][0]->tag, 'EMAIL');
$this
->assertEqual($mergevars[$list_ids[0]][1]->tag, 'FNAME');
$this
->assertEqual($mergevars[$list_ids[0]][2]->tag, 'LNAME');
}
}