You are here

function Braintree_SubscriptionTest::testUpdate_withDescriptor in Commerce Braintree 7

File

braintree_php/tests/integration/SubscriptionTest.php, line 941

Class

Braintree_SubscriptionTest

Code

function testUpdate_withDescriptor() {
  $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
  $plan = Braintree_SubscriptionTestHelper::triallessPlan();
  $subscription = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $plan['id'],
    'descriptor' => array(
      'name' => '123*123456789012345678',
      'phone' => '3334445555',
    ),
  ))->subscription;
  $result = Braintree_Subscription::update($subscription->id, array(
    'descriptor' => array(
      'name' => '999*9999999',
      'phone' => '8887776666',
    ),
  ));
  $updatedSubscription = $result->subscription;
  $this
    ->assertEquals('999*9999999', $updatedSubscription->descriptor->name);
  $this
    ->assertEquals('8887776666', $updatedSubscription->descriptor->phone);
}