public function UcAddressesOrderTestCase::testOrderEditing in Ubercart Addresses 6.2
Same name and namespace in other branches
- 7 tests/uc_addresses.order.test \UcAddressesOrderTestCase::testOrderEditing()
Override of UbercartOrderTestCase::testOrderEditing().
Overrides UbercartOrderTestCase::testOrderEditing
1 call to UcAddressesOrderTestCase::testOrderEditing()
- UcAddressesOrderTestCase::testOrderExtraFields in tests/
uc_addresses.order.test - Test if editing an order works properly when an extra field is added that's not registered through Ubercart Addresses hooks.
File
- tests/
uc_addresses.order.test, line 45 - Test cases for order admin.
Class
- UcAddressesOrderTestCase
- Test cases order administration.
Code
public function testOrderEditing() {
$order = $this
->ucCreateOrder($this->customer);
$this
->drupalLogin($this->customer);
$this
->drupalGet('user/' . $this->customer->uid . '/orders');
$this
->assertText(t('My order history'));
$this
->drupalGet('user/' . $this->customer->uid . '/orders/' . $order->order_id);
$this
->assertResponse(200, 'Customer can view their own order.');
$this
->drupalGet('admin/store/orders/' . $order->order_id);
$this
->assertResponse(403, 'Customer may not edit orders.');
$this
->drupalLogin($this->adminUser);
$this
->drupalGet('user/' . $this->customer->uid . '/order/' . $order->order_id);
$this
->assertText(drupal_strtoupper($order->billing_first_name . ' ' . $order->billing_last_name), 'Found customer name.');
$edit = array(
'billing[billing_first_name]' => $this
->randomName(8),
'billing[billing_last_name]' => $this
->randomName(15),
);
$this
->drupalPost('admin/store/orders/' . $order->order_id . '/edit', $edit, t('Submit changes'));
$this
->assertText(t('Order changes saved.'));
$this
->assertFieldByName('billing[billing_first_name]', $edit['billing[billing_first_name]'], 'Billing first name changed.');
$this
->assertFieldByName('billing[billing_last_name]', $edit['billing[billing_last_name]'], 'Billing last name changed.');
}