You are here

function Messaging_Template_Tests::testMessagingTemplateAPI in Messaging 6.3

Exercise basic API functions

File

tests/messaging_template.test, line 26

Class

Messaging_Template_Tests
Class for testing messaging module.

Code

function testMessagingTemplateAPI() {
  global $language;

  // Login user and test basic pages
  $user = $this
    ->drupalCreateUser();

  // Create template class and exercise the API
  $template = new Messaging_Template();
  $defaults = messaging_template_get_defaults('messaging-template', $language);
  foreach (messaging_template_get_keys('messaging-template') as $key => $name) {
    $this
      ->assertEqual($defaults[$key]->template, $template
      ->text_part('messaging-template', $key), "Got the right template for {$name}");
    $this
      ->assertEqual($defaults[$key]->template, $template
      ->text_part('messaging-template', $key, 'simple'), "Got the right template fallback for {$name}");
  }
}