You are here

public function SchedulerWorkbenchTestCase::setUp in Scheduler Workbench Integration 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

./scheduler_workbench.test, line 44
Automated tests for the scheduler_workbench module.

Class

SchedulerWorkbenchTestCase
Tests the scheduling of content.

Code

public function setUp() {
  parent::setUp('scheduler_workbench');

  // Create a content type.
  $this->contentType = $this
    ->drupalCreateContentType(array());

  // Create an administrator and log in.
  $this->user = $this
    ->drupalCreateUser(array(
    'administer content types',
    'create ' . $this->contentType->type . ' content',
    'edit any ' . $this->contentType->type . ' content',
    'schedule publishing of nodes',
    'override default scheduler time',
  ));
  $this
    ->drupalLogin($this->user);

  // Configure the content type to use scheduling and moderation through the
  // interface.
  $edit = array(
    'node_options[revision]' => TRUE,
    'node_options[moderation]' => TRUE,
    'scheduler_publish_enable' => TRUE,
    'scheduler_unpublish_enable' => TRUE,
  );
  $this
    ->drupalPost('admin/structure/types/manage/' . $this->contentType->type, $edit, t('Save content type'));
  node_types_rebuild();
}