You are here

function Braintree_SubscriptionTest::testCreate_numberOfBillingCyclesCanBeOverridden in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

function testCreate_numberOfBillingCyclesCanBeOverridden() {
  $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(
    'numberOfBillingCycles' => '10',
    'paymentMethodToken' => $creditCard->token,
    'planId' => $plan['id'],
  ));
  $subscription = $result->subscription;
  $this
    ->assertEquals(10, $subscription->numberOfBillingCycles);
  $this
    ->assertFalse($subscription->neverExpires);
}