You are here

messaging_template.test in Messaging 6.3

File

tests/messaging_template.test
View source
<?php

/**
 * Class for testing messaging module.
 *
 * Tests basic API functions
 */
class Messaging_Template_Tests extends MessagingTestCase {
  function getInfo() {
    return array(
      'name' => 'Messaging template',
      'group' => 'Messaging',
      'description' => 'Messaging template API functions',
    );
  }
  function setUp() {
    parent::setUp('token', 'autoload', 'messaging', 'messaging_template', 'messaging_simple');
    variable_set('messaging_method_simple', array(
      'filter' => 0,
    ));
    variable_set('messaging_method_debug', array(
      'filter' => 0,
    ));
  }

  /**
   * Exercise basic API functions
   */
  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}");
    }
  }

}

Classes

Namesort descending Description
Messaging_Template_Tests Class for testing messaging module.