You are here

function Braintree_SubscriptionTest::testCreate_trialPeriondDefaultsToPlanWithTrial in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

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