You are here

function TalkTests::setUp in Talk 6

Same name and namespace in other branches
  1. 7 talk.test \TalkTests::setUp()

Generates a random database prefix, runs the install scripts on the prefixed database and enable the specified modules. After installation many caches are flushed and the internal browser is setup so that the page requests will run on the new prefix. A temporary files directory is created with the same name as the database prefix.

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

File

./talk.test, line 15

Class

TalkTests

Code

function setUp() {

  // Enable the talk module and its dependencies.
  parent::setUp('comment', 'talk', 'token');

  // Create a node type, and enable the talk module for that node type.
  $node_type = $this
    ->drupalCreateContentType();
  $this->talkType = $node_type->type;

  // This will automatically be reverted to whatever it was before the test took place after the test is over.
  variable_set('comment_talk_' . $node_type->type, TRUE);

  // We don't want to deal with comment previews.
  variable_set('comment_preview_' . $node_type->type, COMMENT_PREVIEW_OPTIONAL);

  // Set the talk title to something unique.
  $this->talkTitle = $this
    ->randomName();
  variable_set('talk_page', $this->talkTitle);
  $this->talkLink = $this
    ->randomName();
  variable_set('talk_link', $this->talkLink);
  $this->talkTab = $this
    ->randomName();
  variable_set('talk_tab', $this->talkTab);

  // Create and login a user with the appropriate permissions.
  $permissions = array(
    'access content',
    'access comments',
    'post comments',
    'post comments without approval',
  );
  $user = $this
    ->drupalCreateUser($permissions);
  $this
    ->drupalLogin($user);
}