function CommentTestBase::setUp

Same name in this branch

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 Drupal\simpletest\WebTestBase::$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 WebTestBase::setUp

See also

Drupal\simpletest\WebTestBase::prepareDatabasePrefix()

Drupal\simpletest\WebTestBase::changeDatabasePrefix()

Drupal\simpletest\WebTestBase::prepareEnvironment()

6 calls to CommentTestBase::setUp()
CommentAnonymousTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
Sets up a Drupal site for running functional and integration tests.
CommentAttributesTest::setUp in drupal/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
Sets up a Drupal site for running functional and integration tests.
CommentBlockTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php
Sets up a Drupal site for running functional and integration tests.
CommentCSSTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
Sets up a Drupal site for running functional and integration tests.
CommentNodeAccessTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeAccessTest.php
Sets up a Drupal site for running functional and integration tests.

... See full list

6 methods override CommentTestBase::setUp()
CommentAnonymousTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentAnonymousTest.php
Sets up a Drupal site for running functional and integration tests.
CommentAttributesTest::setUp in drupal/core/modules/rdf/lib/Drupal/rdf/Tests/CommentAttributesTest.php
Sets up a Drupal site for running functional and integration tests.
CommentBlockTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentBlockTest.php
Sets up a Drupal site for running functional and integration tests.
CommentCSSTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentCSSTest.php
Sets up a Drupal site for running functional and integration tests.
CommentNodeAccessTest::setUp in drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentNodeAccessTest.php
Sets up a Drupal site for running functional and integration tests.

... See full list

File

drupal/core/modules/comment/lib/Drupal/comment/Tests/CommentTestBase.php, line 47
Contains Drupal\comment\Tests\CommentTestBase.

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\comment\Tests

Code

function setUp() {
  parent::setUp();

  // Create an article content type only if it does not yet exist, so that
  // child classes may specify the standard profile.
  $types = node_type_get_types();
  if (empty($types['article'])) {
    $this
      ->drupalCreateContentType(array(
      'type' => 'article',
      'name' => t('Article'),
    ));
  }

  // Create two test users.
  $this->admin_user = $this
    ->drupalCreateUser(array(
    'administer content types',
    'administer comments',
    'administer comment fields',
    'skip comment approval',
    'post comments',
    'access comments',
    'access content',
  ));
  $this->web_user = $this
    ->drupalCreateUser(array(
    'access comments',
    'post comments',
    'create article content',
    'edit own comments',
    'post comments',
    'skip comment approval',
    'access content',
  ));

  // Create a test node authored by the web user.
  $this->node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
    'promote' => 1,
    'uid' => $this->web_user->uid,
  ));
}