You are here

function Braintree_SubscriptionTest::testCreate_firstBillingDateCanBeSet in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

function testCreate_firstBillingDateCanBeSet() {
  $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
  $plan = Braintree_SubscriptionTestHelper::billingDayOfMonthPlan();
  $tomorrow = new DateTime("now + 1 day");
  $tomorrow
    ->setTime(0, 0, 0);
  $result = Braintree_Subscription::create(array(
    'paymentMethodToken' => $creditCard->token,
    'planId' => $plan['id'],
    'firstBillingDate' => $tomorrow,
  ));
  $subscription = $result->subscription;
  $this
    ->assertEquals($tomorrow, $subscription->firstBillingDate);
  $this
    ->assertEquals(Braintree_Subscription::PENDING, $result->subscription->status);
}