You are here

protected function CommentTestBase::setUp in Zircon Profile 8

Same name in this branch
  1. 8 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setUp()
  2. 8 core/modules/comment/src/Tests/Views/CommentTestBase.php \Drupal\comment\Tests\Views\CommentTestBase::setUp()
  3. 8 core/modules/comment/tests/src/Unit/Migrate/d6/CommentTestBase.php \Drupal\Tests\comment\Unit\Migrate\d6\CommentTestBase::setUp()
Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setUp()

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

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.

Overrides WebTestBase::setUp

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

... See full list

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

... See full list

File

core/modules/comment/src/Tests/CommentTestBase.php, line 53
Contains \Drupal\comment\Tests\CommentTestBase.

Class

CommentTestBase
Provides setup and helper methods for comment tests.

Namespace

Drupal\comment\Tests

Code

protected 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 = NodeType::loadMultiple();
  if (empty($types['article'])) {
    $this
      ->drupalCreateContentType(array(
      'type' => 'article',
      'name' => t('Article'),
    ));
  }

  // Create two test users.
  $this->adminUser = $this
    ->drupalCreateUser(array(
    'administer content types',
    'administer comments',
    'administer comment types',
    'administer comment fields',
    'administer comment display',
    'skip comment approval',
    'post comments',
    'access comments',
    // Usernames aren't shown in comment edit form autocomplete unless this
    // permission is granted.
    'access user profiles',
    'access content',
  ));
  $this->webUser = $this
    ->drupalCreateUser(array(
    'access comments',
    'post comments',
    'create article content',
    'edit own comments',
    'skip comment approval',
    'access content',
  ));

  // Create comment field on article.
  $this
    ->addDefaultCommentField('node', 'article');

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