You are here

public function UbercartOrderTestCase::testOrderCreation in Ubercart 6.2

Same name and namespace in other branches
  1. 7.3 uc_order/tests/uc_order.test \UbercartOrderTestCase::testOrderCreation()

File

uc_order/uc_order.test, line 21
Tests for Ubercart orders.

Class

UbercartOrderTestCase

Code

public function testOrderCreation() {
  $this
    ->drupalLogin($this->adminUser);
  $edit = array(
    'uid' => $this->customer->uid,
  );
  $this
    ->drupalPost('admin/store/orders/create', $edit, t('Create order'));
  $this
    ->assertText(t('Order created by the administration.'), 'Order created by the administration.');
  $this
    ->assertFieldByName('uid_text', $this->customer->uid, 'The customer UID appears on the page.');
  $order_id = db_result(db_query("SELECT order_id FROM {uc_orders} WHERE uid = %d", $this->customer->uid));
  $this
    ->assertTrue($order_id, t('Found order ID @order_id', array(
    '@order_id' => $order_id,
  )));
  $this
    ->drupalGet('admin/store/orders');
  $links = $this
    ->xpath('//a[@href="' . url('admin/store/orders/' . $order_id) . '"]');
  $this
    ->assertTrue(isset($links[0]), 'View link appears on order list.');
  $this
    ->assertText('Pending', 'New order is "Pending".');
}