You are here

public function MailchimpEcommerceCommerceTestCase::testAddStoreNoList in Mailchimp E-Commerce 7

Tests adding a store to Mailchimp with no list/audience.

File

modules/mailchimp_ecommerce_commerce/tests/mailchimp_ecommerce_commerce.test, line 93
Test class and methods for the Mailchimp eCommerce Commerce module.

Class

MailchimpEcommerceCommerceTestCase
Tests for Mailchimp eCommerce integration with Drupal Commerce.

Code

public function testAddStoreNoList() {
  $admin = $this
    ->drupalCreateUser([
    'administer site configuration',
    'administer mailchimp',
  ]);
  $this
    ->drupalLogin($admin);
  $edit = [];
  $edit['mailchimp_ecommerce_integration'] = 'commerce';
  $edit['mailchimp_ecommerce_store_name'] = 'Freddie\'s Merchandise';
  $edit['mailchimp_ecommerce_currency'] = 'USD';
  $this
    ->drupalPost('admin/config/services/mailchimp/ecommerce', $edit, t('Save configuration'));
  $this
    ->assertNoText(t('The configuration options have been saved.'), 'The text "The configuration options have been saved." should not appear on the page that adds a store.');
  $this
    ->assertText(t('Store List field is required.'), 'The text "Store List field is required." should appear on the page, indicating a form validation error.');
}