You are here

function WorkbenchModerationTestCase::setUp in Workbench Moderation 7

Same name and namespace in other branches
  1. 7.3 tests/workbench_moderation.test \WorkbenchModerationTestCase::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 DrupalWebTestCase::setUp

See also

DrupalWebTestCase::prepareDatabasePrefix()

DrupalWebTestCase::changeDatabasePrefix()

DrupalWebTestCase::prepareEnvironment()

6 calls to WorkbenchModerationTestCase::setUp()
WorkbenchModerationDraftTabTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationExternalNodeUpdateTestCase::setUp in tests/external_node_update.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationModerateTabTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationPublishFromNodeFormTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationUnpublishTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.

... See full list

6 methods override WorkbenchModerationTestCase::setUp()
WorkbenchModerationDraftTabTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationExternalNodeUpdateTestCase::setUp in tests/external_node_update.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationModerateTabTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationPublishFromNodeFormTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.
WorkbenchModerationUnpublishTestCase::setUp in tests/workbench_moderation.test
Sets up a Drupal site for running functional and integration tests.

... See full list

File

tests/workbench_moderation.test, line 12
Tests for workbench_moderation.module.

Class

WorkbenchModerationTestCase
@file Tests for workbench_moderation.module.

Code

function setUp($modules = array()) {
  $modules = array_merge($modules, array(
    'workbench_moderation',
    'workbench_moderation_test',
  ));
  parent::setUp($modules);

  // 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',
  ));

  // Create and login user.
  $this->moderator_user = $this
    ->drupalCreateUser(array(
    'access content',
    'view revisions',
    'view all unpublished content',
    'view moderation history',
    'view moderation messages',
    'bypass workbench moderation',
    "create {$this->content_type} content",
    "edit any {$this->content_type} content",
  ));
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'bypass node access',
    'administer nodes',
    'view revisions',
    'view all unpublished content',
    'view moderation history',
    'view moderation messages',
    'bypass workbench moderation',
    "create {$this->content_type} content",
  ));
}