You are here

public function MailhandlerTestCase::setUp in Mailhandler 7.2

Same name and namespace in other branches
  1. 6.2 tests/mailhandler.test \MailhandlerTestCase::setUp()
  2. 6 mailhandler.test \MailhandlerTestCase::setUp()

Implements setUp().

Overrides DrupalWebTestCase::setUp

File

tests/mailhandler.test, line 28
Tests for Mailhandler modules.

Class

MailhandlerTestCase
Mailhandler test cases.

Code

public function setUp() {
  parent::setUp('taxonomy', 'file', 'mailhandler', 'mailhandler_php_imap', 'mailhandler_default', 'text', 'multiple_email', 'mailhandler_multiple_email');
  $permissions = array(
    'administer nodes',
    'bypass node access',
    'administer mailhandler',
    'administer feeds',
    'administer taxonomy',
    'administer content types',
    'use multiple emails',
  );
  $this->mailhandler_user = $this
    ->drupalCreateUser($permissions);

  // Create and log in our privileged user.
  $this->mailhandler_user->is_new = FALSE;
  user_save($this->mailhandler_user, array(
    'mail' => 'from@example.com',
  ));
  $this
    ->drupalLogin($this->mailhandler_user);
  $edit = array(
    'email' => 'second@example.com',
  );
  $this
    ->drupalPost('user/' . $this->mailhandler_user->uid . '/edit/email-addresses', $edit, t('Save'));
  $src = drupal_get_path('module', 'mailhandler') . '/tests/mbox/';
  $dest = file_directory_temp() . '/mailhandler_test';
  shell_exec("cp -r {$src} {$dest}");
}