You are here

function Braintree_SubscriptionTest::testUpdate_UpdatesSubscriptionWhenProrationTransactionFailsAndRevertIsFalse in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

function testUpdate_UpdatesSubscriptionWhenProrationTransactionFailsAndRevertIsFalse() {
  $subscription = Braintree_SubscriptionTestHelper::createSubscription();
  $result = Braintree_Subscription::update($subscription->id, array(
    'price' => $subscription->price + 2100,
    'options' => array(
      'prorateCharges' => true,
      'revertSubscriptionOnProrationFailure' => false,
    ),
  ));
  $this
    ->assertTrue($result->success);
  $this
    ->assertEquals(sizeof($subscription->transactions) + 1, sizeof($result->subscription->transactions));
  $this
    ->assertEquals(Braintree_Transaction::PROCESSOR_DECLINED, $result->subscription->transactions[0]->status);
  $this
    ->assertEquals($result->subscription->transactions[0]->amount, $result->subscription->balance);
  $this
    ->assertEquals($subscription->price + 2100, $result->subscription->price);
}