You are here

function PaymentCommerceCheckoutWebTestCase::testCheckoutSuccess in Payment for Drupal Commerce 7

Same name and namespace in other branches
  1. 7.2 tests/PaymentCommerceCheckoutWebTestCase.test \PaymentCommerceCheckoutWebTestCase::testCheckoutSuccess()

Tests the checkout process for a successful payment.

File

tests/PaymentCommerceCheckoutWebTestCase.test, line 50

Class

PaymentCommerceCheckoutWebTestCase

Code

function testCheckoutSuccess() {
  $status = PAYMENT_STATUS_SUCCESS;

  // Create a payment method.
  $payment_method = PaymentWebTestCase::paymentMethodCreate(0, payment_method_controller_load('PaymentMethodBasicController'));
  $payment_method->controller_data['status'] = $status;
  entity_save('payment_method', $payment_method);
  drupal_static_reset();
  drupal_flush_all_caches();

  // Test an authenticated checkout.
  $user = $this
    ->assertLogin();
  $this
    ->assertCheckout($this->product->product_id, $this->loggedInUser->uid, $payment_method->pmid, $this->payment_method_unavailable->pmid);
  $order_id = $this
    ->getLastOrderID();
  $this
    ->assertUrl('checkout/' . $order_id . '/complete');
  $this
    ->assertPaymentExists($order_id, $status);
}