You are here

protected function CommentTestBase::setUp in Zircon Profile 8.0

Same name in this branch
  1. 8.0 core/modules/comment/src/Tests/CommentTestBase.php \Drupal\comment\Tests\CommentTestBase::setUp()
  2. 8.0 core/modules/comment/src/Tests/Views/CommentTestBase.php \Drupal\comment\Tests\Views\CommentTestBase::setUp()
  3. 8.0 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 core/modules/comment/src/Tests/Views/CommentTestBase.php \Drupal\comment\Tests\Views\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 ViewTestBase::setUp

3 calls to CommentTestBase::setUp()
CommentFieldFilterTest::setUp in core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
Sets up a Drupal site for running functional and integration tests.
CommentFieldNameTest::setUp in core/modules/comment/src/Tests/Views/CommentFieldNameTest.php
Sets up a Drupal site for running functional and integration tests.
CommentRestExportTest::setUp in core/modules/comment/src/Tests/Views/CommentRestExportTest.php
Sets up a Drupal site for running functional and integration tests.
3 methods override CommentTestBase::setUp()
CommentFieldFilterTest::setUp in core/modules/comment/src/Tests/Views/CommentFieldFilterTest.php
Sets up a Drupal site for running functional and integration tests.
CommentFieldNameTest::setUp in core/modules/comment/src/Tests/Views/CommentFieldNameTest.php
Sets up a Drupal site for running functional and integration tests.
CommentRestExportTest::setUp in core/modules/comment/src/Tests/Views/CommentRestExportTest.php
Sets up a Drupal site for running functional and integration tests.

File

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

Class

CommentTestBase
Tests the argument_comment_user_uid handler.

Namespace

Drupal\comment\Tests\Views

Code

protected function setUp() {
  parent::setUp();
  ViewTestData::createTestViews(get_class($this), array(
    'comment_test_views',
  ));

  // Add two users, create a node with the user1 as author and another node
  // with user2 as author. For the second node add a comment from user1.
  $this->account = $this
    ->drupalCreateUser(array(
    'skip comment approval',
  ));
  $this->account2 = $this
    ->drupalCreateUser();
  $this
    ->drupalLogin($this->account);
  $this
    ->drupalCreateContentType(array(
    'type' => 'page',
    'name' => t('Basic page'),
  ));
  $this
    ->addDefaultCommentField('node', 'page');
  $this->nodeUserPosted = $this
    ->drupalCreateNode();
  $this->nodeUserCommented = $this
    ->drupalCreateNode(array(
    'uid' => $this->account2
      ->id(),
  ));
  $comment = array(
    'uid' => $this->loggedInUser
      ->id(),
    'entity_id' => $this->nodeUserCommented
      ->id(),
    'entity_type' => 'node',
    'field_name' => 'comment',
    'subject' => 'How much wood would a woodchuck chuck',
    'cid' => '',
    'pid' => '',
    'mail' => 'someone@example.com',
  );
  $this->comment = entity_create('comment', $comment);
  $this->comment
    ->save();
}