You are here

public function UbercartOrderTestCase::testEntityHooks in Ubercart 7.3

Tests order entity CRUD hooks.

File

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

Class

UbercartOrderTestCase
Tests for Ubercart orders.

Code

public function testEntityHooks() {
  module_enable(array(
    'entity_crud_hook_test',
  ));
  $_SESSION['entity_crud_hook_test'] = array();
  $order = uc_order_new();
  $this
    ->assertHookMessage('entity_crud_hook_test_entity_presave called for type uc_order');
  $this
    ->assertHookMessage('entity_crud_hook_test_entity_insert called for type uc_order');
  $_SESSION['entity_crud_hook_test'] = array();
  $order = uc_order_load($order->order_id);
  $this
    ->assertHookMessage('entity_crud_hook_test_entity_load called for type uc_order');
  $_SESSION['entity_crud_hook_test'] = array();
  uc_order_save($order);
  $this
    ->assertHookMessage('entity_crud_hook_test_entity_presave called for type uc_order');
  $this
    ->assertHookMessage('entity_crud_hook_test_entity_update called for type uc_order');
  $_SESSION['entity_crud_hook_test'] = array();
  uc_order_delete($order->order_id);
  $this
    ->assertHookMessage('entity_crud_hook_test_entity_delete called for type uc_order');
}