You are here

public function CommercePaymentUITest::testCommercePaymentCheckout in Commerce Core 7

Test the payment on checkout process using an authenticated user.

File

modules/payment/tests/commerce_payment_ui.test, line 95
Functional tests for the commerce payment module user interface.

Class

CommercePaymentUITest
Test payment user interface.

Code

public function testCommercePaymentCheckout() {
  $this
    ->createOrderAndGoToPayment();
  $this
    ->assertText('Example payment', t('Example payment method pane is present'));

  // Finish checkout process.
  $this
    ->drupalPost(NULL, array(), t('Continue to next step'));

  // Load payment to check its status.
  $payment = commerce_payment_transaction_load_multiple(array(), array(
    'order_id' => $this->order->order_id,
  ), TRUE);

  // Order status should be pending when completing checkout process.
  $this
    ->assertEqual(reset($payment)->status, 'success', t('Payment was successfully processed'));

  // Check if the completion message has been displayed.
  $this
    ->assertTitle(t('Checkout complete') . ' | Drupal', t('Checkout process completed successfully'));
}