You are here

function Braintree_SubscriptionTest::testCreate_alterPlanTrialPeriod in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

function testCreate_alterPlanTrialPeriod() {
  $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
  $plan = Braintree_SubscriptionTestHelper::trialPlan();
  $result = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $plan['id'],
    'trialDuration' => 5,
    'trialDurationUnit' => 'month',
  ));
  $subscription = $result->subscription;
  $this
    ->assertTrue($subscription->trialPeriod);
  $this
    ->assertEquals(5, $subscription->trialDuration);
  $this
    ->assertEquals('month', $subscription->trialDurationUnit);
}