You are here

protected function CommerceMessageTestBase::loadMessagesForOrder in Commerce Message 7

Loads message entities referencing an order.

Parameters

object $order: The commerce_order entity.

Return value

Message[] Array of entities.

3 calls to CommerceMessageTestBase::loadMessagesForOrder()
CommerceMessageAdminOrderNotificationTest::testOrderNotificationMessageCreation in ./commerce_message.test
Tests that the notification is generated on checkout complete.
CommerceMessageOrderHistoryTest::testOrderHistory in ./commerce_message.test
Test order history programmatically.
CommerceMessageOrderNotificationTest::testOrderNotificationMessageCreation in ./commerce_message.test
Tests that the notification is generated on checkout complete.

File

./commerce_message.test, line 61

Class

CommerceMessageTestBase

Code

protected function loadMessagesForOrder($order) {
  $query = new EntityFieldQuery();
  $query
    ->entityCondition('entity_type', 'message')
    ->fieldCondition('message_commerce_order', 'target_id', $order->order_id)
    ->propertyOrderBy('timestamp', 'ASC');
  $results = $query
    ->execute();
  if (!empty($results)) {
    return entity_load('message', array_keys($results['message']));
  }
  return array();
}