You are here

public function UbercartOrderTestCase::testOrderApi in Ubercart 7.3

Tests order entity API functions.

File

uc_order/tests/uc_order.test, line 24
Tests for Ubercart orders.

Class

UbercartOrderTestCase
Tests for Ubercart orders.

Code

public function testOrderApi() {

  // Test defaults.
  $order = uc_order_new();
  $this
    ->assertEqual($order->uid, 0, 'New order is anonymous.');
  $this
    ->assertEqual($order->order_status, 'in_checkout', 'New order is in checkout.');
  $order = uc_order_new($this->customer->uid, 'completed');
  $this
    ->assertEqual($order->uid, $this->customer->uid, 'New order has correct uid.');
  $this
    ->assertEqual($order->order_status, 'completed', 'New order is marked completed.');

  // Test deletion.
  uc_order_delete($order->order_id);
  $deleted_order = uc_order_load($order->order_id, TRUE);
  $this
    ->assertFalse($deleted_order, 'Order was successfully deleted');
}