You are here

function Braintree_CustomerTest::testUpdate in Commerce Braintree 7

File

braintree_php/tests/integration/CustomerTest.php, line 373

Class

Braintree_CustomerTest

Code

function testUpdate() {
  $result = Braintree_Customer::create(array(
    'firstName' => 'Old First',
    'lastName' => 'Old Last',
    'company' => 'Old Company',
    'email' => 'old.email@example.com',
    'phone' => 'old phone',
    'fax' => 'old fax',
    'website' => 'http://old.example.com',
  ));
  $this
    ->assertEquals(true, $result->success);
  $customer = $result->customer;
  $updateResult = Braintree_Customer::update($customer->id, array(
    'firstName' => 'New First',
    'lastName' => 'New Last',
    'company' => 'New Company',
    'email' => 'new.email@example.com',
    'phone' => 'new phone',
    'fax' => 'new fax',
    'website' => 'http://new.example.com',
  ));
  $this
    ->assertEquals(true, $updateResult->success);
  $this
    ->assertEquals('New First', $updateResult->customer->firstName);
  $this
    ->assertEquals('New Last', $updateResult->customer->lastName);
  $this
    ->assertEquals('New Company', $updateResult->customer->company);
  $this
    ->assertEquals('new.email@example.com', $updateResult->customer->email);
  $this
    ->assertEquals('new phone', $updateResult->customer->phone);
  $this
    ->assertEquals('new fax', $updateResult->customer->fax);
  $this
    ->assertEquals('http://new.example.com', $updateResult->customer->website);
}