You are here

function MessageSubscribeQueueTest::setUp in Message Subscribe 7

Sets up a Drupal site for running functional and integration tests.

Generates a random database prefix and installs Drupal with the specified installation profile in DrupalWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Overrides DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

File

./message_subscribe.test, line 421
Test for the Message subscribe module.

Class

MessageSubscribeQueueTest
Test queue integration.

Code

function setUp() {
  parent::setUp('message_subscribe');

  // Override default notifiers.
  variable_set('message_subscribe_default_notifiers', array());

  // Enable using queue.
  variable_set('message_subscribe_use_queue', TRUE);

  // Create a dummy message-type.
  $message_type = message_type_create('foo', array(
    'message_text' => array(
      LANGUAGE_NONE => array(
        array(
          'value' => 'Example text.',
        ),
      ),
    ),
  ));
  $message_type
    ->save();

  // Create node-type.
  $type = $this
    ->drupalCreateContentType();
  $node_type = $type->type;

  // Create node.
  $user1 = $this
    ->drupalCreateUser();
  $settings = array();
  $settings['type'] = $node_type;
  $settings['uid'] = $user1->uid;
  $this->node = $this
    ->drupalCreateNode($settings);
}