You are here

public function MailchimpEcommerceTest::testAddStore in Mailchimp 8

Tests library function for adding a new store.

File

lib/mailchimp-api-php/tests/MailchimpEcommerceTest.php, line 41

Class

MailchimpEcommerceTest
Mailchimp Ecommerce test library.

Namespace

Mailchimp\Tests

Code

public function testAddStore() {
  $id = 'MC001';
  $store = [
    'list_id' => '205d96e6b4',
    'name' => "Freddie's Merchandise",
    'currency_code' => 'USD',
  ];
  $mc = new MailchimpEcommerce();
  $mc
    ->addStore($id, $store);
  $this
    ->assertEquals('POST', $mc
    ->getClient()->method);
  $this
    ->assertEquals($mc
    ->getEndpoint() . '/ecommerce/stores', $mc
    ->getClient()->uri);
  $this
    ->assertNotEmpty($mc
    ->getClient()->options['json']);
  $request_body = $mc
    ->getClient()->options['json'];
  $this
    ->assertEquals($id, $request_body->id);
  $this
    ->assertEquals($store['list_id'], $request_body->list_id);
  $this
    ->assertEquals($store['name'], $request_body->name);
  $this
    ->assertEquals($store['currency_code'], $request_body->currency_code);
}