public function MailchimpEcommerceTest::testUpdateCustomer in Mailchimp 8
Tests library function for updating a customer.
File
- lib/
mailchimp-api-php/ tests/ MailchimpEcommerceTest.php, line 352
Class
- MailchimpEcommerceTest
- Mailchimp Ecommerce test library.
Namespace
Mailchimp\TestsCode
public function testUpdateCustomer() {
$store_id = 'MC001';
$customer = [
'id' => 'cust0001',
'email_address' => 'freddie@freddiesjokes.com',
'opt_in_status' => TRUE,
];
$mc = new MailchimpEcommerce();
$mc
->updateCustomer($store_id, $customer);
$this
->assertEquals('PATCH', $mc
->getClient()->method);
$this
->assertEquals($mc
->getEndpoint() . '/ecommerce/stores/' . $store_id . '/customers/' . $customer['id'], $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);
}