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