You are here

function PaymentCommerceDeleteOrderWebTestCase::testDeleteOrder in Payment for Drupal Commerce 7

Same name and namespace in other branches
  1. 7.2 tests/PaymentCommerceDeleteOrderWebTestCase.test \PaymentCommerceDeleteOrderWebTestCase::testDeleteOrder()

File

tests/PaymentCommerceDeleteOrderWebTestCase.test, line 25

Class

PaymentCommerceDeleteOrderWebTestCase

Code

function testDeleteOrder() {

  // Delete an order, but keep its payments.
  $pid = $this
    ->assertCreateAndDeleteOrderAndPayment();
  $this
    ->assertTrue((bool) entity_load('payment', array(
    $pid,
  ), array(), TRUE));

  // Delete an order and its payments.
  variable_set('payment_commerce_order_delete', TRUE);
  $pid = $this
    ->assertCreateAndDeleteOrderAndPayment();
  $this
    ->assertFalse((bool) entity_load('payment', array(
    $pid,
  ), array(), TRUE));

  // Delete an order without payments.
  $order = commerce_order_new();
  commerce_order_save($order);
  commerce_order_delete($order->order_id);
  $this
    ->assertFalse(commerce_order_load($order->order_id));
}