You are here

function Braintree_SubscriptionTest::testCreate_numberOfBillingCyclesCanBeOverriddenToNeverExpire in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

function testCreate_numberOfBillingCyclesCanBeOverriddenToNeverExpire() {
  $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
  $plan = Braintree_SubscriptionTestHelper::trialPlan();
  $result = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $plan['id'],
  ));
  $subscription = $result->subscription;
  $this
    ->assertEquals($plan['numberOfBillingCycles'], $subscription->numberOfBillingCycles);
  $result = Braintree_Subscription::create(array(
    'neverExpires' => true,
    'paymentMethodToken' => $creditCard->token,
    'planId' => $plan['id'],
  ));
  $subscription = $result->subscription;
  $this
    ->assertNull($subscription->numberOfBillingCycles);
  $this
    ->assertTrue($subscription->neverExpires);
}