You are here

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

Tests adding a product to Mailchimp.

File

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

Class

MailchimpEcommerceCommerceTestCase
Tests for Mailchimp eCommerce integration with Drupal Commerce.

Code

public function testAddProduct() {

  // Should pass.
  $admin = $this
    ->drupalCreateUser([
    'administer site configuration',
    'configure store',
    'administer commerce_product entities',
  ]);
  $this
    ->drupalLogin($admin);
  $edit = [];
  $edit['sku'] = 'Jokes002';
  $edit['title'] = 'Freddie\'s Jokes Volume 2';
  $edit['commerce_price[und][0][amount]'] = 5;
  $edit['status'] = 1;
  $this
    ->drupalPost('admin/commerce/products/add/product', $edit, t('Save product'));
  $this
    ->assertText(t('Product saved.'), 'The text "Product saved." should appear on the page, indicating a product was added successfully.');
}