You are here

function Braintree_SubscriptionTest::testCreate_withDescriptor in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

function testCreate_withDescriptor() {
  $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
  $plan = Braintree_SubscriptionTestHelper::triallessPlan();
  $result = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $plan['id'],
    'descriptor' => array(
      'name' => '123*123456789012345678',
      'phone' => '3334445555',
    ),
  ));
  $this
    ->assertTrue($result->success);
  $subscription = $result->subscription;
  $this
    ->assertEquals('123*123456789012345678', $subscription->descriptor->name);
  $this
    ->assertEquals('3334445555', $subscription->descriptor->phone);
  $transaction = $subscription->transactions[0];
  $this
    ->assertEquals('123*123456789012345678', $transaction->descriptor->name);
  $this
    ->assertEquals('3334445555', $transaction->descriptor->phone);
}