public function MailchimpEcommerceTest::testAddCustomer in Mailchimp 8
Tests library function for adding a customer.
File
- lib/
mailchimp-api-php/ tests/ MailchimpEcommerceTest.php, line 326
Class
- MailchimpEcommerceTest
- Mailchimp Ecommerce test library.
Namespace
Mailchimp\TestsCode
public function testAddCustomer() {
$store_id = 'MC001';
$customer = [
'id' => 'cust0001',
'email_address' => 'freddie@freddiesjokes.com',
'opt_in_status' => TRUE,
];
$mc = new MailchimpEcommerce();
$mc
->addCustomer($store_id, $customer);
$this
->assertEquals('POST', $mc
->getClient()->method);
$this
->assertEquals($mc
->getEndpoint() . '/ecommerce/stores/' . $store_id . '/customers', $mc
->getClient()->uri);
$this
->assertNotEmpty($mc
->getClient()->options['json']);
$request_body = $mc
->getClient()->options['json'];
$this
->assertEquals($customer['id'], $request_body->id);
$this
->assertEquals($customer['email_address'], $request_body->email_address);
$this
->assertEquals($customer['opt_in_status'], $request_body->opt_in_status);
}