You are here

function PaymentUbercartCheckoutWebTestCase::testCheckout in Payment for Ubercart 7.2

Same name and namespace in other branches
  1. 7 tests/PaymentUbercartCheckoutWebTestCase.test \PaymentUbercartCheckoutWebTestCase::testCheckout()

File

tests/PaymentUbercartCheckoutWebTestCase.test, line 18

Class

PaymentUbercartCheckoutWebTestCase

Code

function testCheckout() {

  // Create payment method.
  $payment_method = $this
    ->paymentMethodCreate(0, payment_method_controller_load('PaymentMethodBasicController'));
  entity_save('payment_method', $payment_method);

  // Create a user.
  $user = $this
    ->drupalCreateUser(array(
    'create product content',
    'create orders',
    'view own orders',
  ));
  $this
    ->drupalLogin($user);

  // Set up the store.
  $this
    ->drupalPost('node/add/product', array(
    'title' => 'foo',
    'model' => 'bar',
    'sell_price' => '12.34',
  ), t('Save'));

  // Test an authenticated checkout.
  $this
    ->assertCheckout(1, $payment_method->pmid);

  // Test an anonymous checkout.
  $this
    ->drupalLogout();
  $this
    ->assertCheckout(1, $payment_method->pmid);
}