public function CommerceMessageAdminOrderNotificationTest::testOrderNotificationMessageContent in Commerce Message 7
Test the order message's content.
File
- ./
commerce_message.test, line 333
Class
- CommerceMessageAdminOrderNotificationTest
- Class CommerceMessageAdminOrderNotificationTest
Code
public function testOrderNotificationMessageContent() {
$order = $this
->createDummyOrder();
$message = message_create('commerce_order_admin_order_confirmation', array(), $this->store_admin);
$message
->wrapper()->message_commerce_order = $order;
$message
->save();
$mid = $message->mid;
// Reload the message to see it was saved.
$message = message_load($mid);
$this
->assertTrue(!empty($message->mid), t('Message was saved to the database.'));
$message = $message
->buildContent();
global $language;
$url_options = array(
'absolute' => TRUE,
'language' => $language,
);
$this
->assertEqual(t('Order @order_id at @site', array(
'@order_id' => $order->order_id,
'@site' => variable_get('site_name', 'Drupal'),
)), $message['message__message_text__0']['#markup']);
$body = t('A new order (@order_id) has been placed at @site.
Here is a link to the order:
@order-view', array(
'@order_id' => $order->order_id,
'@site' => variable_get('site_name', 'Drupal'),
'@login-url' => url('user', $url_options),
'@order-view' => url('user/' . $order->uid . '/orders/' . $order->order_id, $url_options),
));
$this
->assertEqual($body, $message['message__message_text__1']['#markup']);
}