Пример #1
0
 public function testCreate_firstBillingDateInThePast()
 {
     $creditCard = SubscriptionHelper::createCreditCard();
     $plan = SubscriptionHelper::billingDayOfMonthPlan();
     $past = new DateTime("now - 3 days");
     $past->setTime(0, 0, 0);
     $result = Braintree\Subscription::create(['paymentMethodToken' => $creditCard->token, 'planId' => $plan['id'], 'firstBillingDate' => $past]);
     $this->assertFalse($result->success);
     $errors = $result->errors->forKey('subscription')->onAttribute('firstBillingDate');
     $this->assertEquals(Braintree\Error\Codes::SUBSCRIPTION_FIRST_BILLING_DATE_CANNOT_BE_IN_THE_PAST, $errors[0]->code);
 }