public function UbercartOrderTestCase::testOrderCreation in Ubercart 7.3
Same name and namespace in other branches
- 6.2 uc_order/uc_order.test \UbercartOrderTestCase::testOrderCreation()
Tests admin order creation.
File
- uc_order/
tests/ uc_order.test, line 98 - Tests for Ubercart orders.
Class
- UbercartOrderTestCase
- Tests for Ubercart orders.
Code
public function testOrderCreation() {
$this
->drupalLogin($this->adminUser);
$edit = array(
'customer_type' => 'search',
'customer[email]' => $this->customer->mail,
);
$this
->drupalPost('admin/store/orders/create', $edit, t('Search'));
$edit['customer[uid]'] = $this->customer->uid;
$this
->drupalPost(NULL, $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_query("SELECT order_id FROM {uc_orders} WHERE uid = :uid", array(
':uid' => $this->customer->uid,
))
->fetchField();
$this
->assertTrue($order_id, t('Found order ID @order_id', array(
'@order_id' => $order_id,
)));
$this
->drupalGet('admin/store/orders');
$this
->assertLinkByHref('admin/store/orders/' . $order_id, 0, 'View link appears on order list.');
$this
->assertText('Pending', 'New order is "Pending".');
}