You are here

function Braintree_SubscriptionTest::testUpdate_DoesNotUpdateSubscriptionWhenProrationTransactionFailsAndRevertIsTrue in Commerce Braintree 7

File

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

Class

Braintree_SubscriptionTest

Code

function testUpdate_DoesNotUpdateSubscriptionWhenProrationTransactionFailsAndRevertIsTrue() {
  $subscription = Braintree_SubscriptionTestHelper::createSubscription();
  $result = Braintree_Subscription::update($subscription->id, array(
    'price' => $subscription->price + 2100,
    'options' => array(
      'prorateCharges' => true,
      'revertSubscriptionOnProrationFailure' => true,
    ),
  ));
  $this
    ->assertFalse($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("0.00", $result->subscription->balance);
  $this
    ->assertEquals($subscription->price, $result->subscription->price);
}