You are here

function WorkbenchModerationFilesTestCase::setUp in Workbench Moderation 7.3

Same name and namespace in other branches
  1. 7 tests/workbench_moderation.files.test \WorkbenchModerationFilesTestCase::setUp()

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 FileFieldTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

File

tests/workbench_moderation.files.test, line 14
Tests for using file fields with workbench_moderation.module.

Class

WorkbenchModerationFilesTestCase
@file Tests for using file fields with workbench_moderation.module.

Code

function setUp() {
  parent::setUp();
  module_enable(array(
    'drafty',
    'workbench_moderation',
  ));

  // Create a new content type and enable moderation on it.
  $type = $this
    ->drupalCreateContentType();
  $this->content_type = $type->name;
  variable_set('node_options_' . $this->content_type, array(
    'revision',
    'moderation',
  ));

  // Add a file field to the new content type.
  $this->field_name = strtolower($this
    ->randomName());
  $this
    ->createFileField($this->field_name, $this->content_type);
  $this->moderator_user = $this
    ->drupalCreateUser(array(
    'access content',
    'access administration pages',
    'administer site configuration',
    'administer users',
    'administer permissions',
    'administer content types',
    'administer nodes',
    'bypass node access',
    'view revisions',
    'revert revisions',
    "edit any {$this->content_type} content",
    'view moderation history',
    'view moderation messages',
    'bypass workbench moderation',
  ));
  $this
    ->drupalLogin($this->moderator_user);
}