You are here

function CommentHelperCase::setUp in Drupal 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()

3 calls to CommentHelperCase::setUp()
CommentAnonymous::setUp in modules/comment/comment.test
Sets up a Drupal site for running functional and integration tests.
CommentNodeAccessTest::setUp in modules/comment/comment.test
Sets up a Drupal site for running functional and integration tests.
RdfCommentAttributesTestCase::setUp in modules/rdf/rdf.test
Sets up a Drupal site for running functional and integration tests.
3 methods override CommentHelperCase::setUp()
CommentAnonymous::setUp in modules/comment/comment.test
Sets up a Drupal site for running functional and integration tests.
CommentNodeAccessTest::setUp in modules/comment/comment.test
Sets up a Drupal site for running functional and integration tests.
RdfCommentAttributesTestCase::setUp in modules/rdf/rdf.test
Sets up a Drupal site for running functional and integration tests.

File

modules/comment/comment.test, line 14
Tests for comment.module.

Class

CommentHelperCase
@file Tests for comment.module.

Code

function setUp() {
  $modules = func_get_args();
  if (isset($modules[0]) && is_array($modules[0])) {
    $modules = $modules[0];
  }
  $modules[] = 'comment';
  parent::setUp($modules);

  // Create users and test node.
  $this->super_user = $this
    ->drupalCreateUser(array(
    'access administration pages',
    'administer modules',
  ));
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer content types',
    'administer comments',
    'administer blocks',
    'administer actions',
    'administer fields',
  ));
  $this->web_user = $this
    ->drupalCreateUser(array(
    'access comments',
    'post comments',
    'create article content',
    'edit own comments',
  ));
  $this->node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'promote' => 1,
    'uid' => $this->web_user->uid,
  ));
}