You are here

protected function MigrateCommentStubTest::setUp in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/comment/src/Tests/Migrate/MigrateCommentStubTest.php \Drupal\comment\Tests\Migrate\MigrateCommentStubTest::setUp()

Performs setup tasks before each individual test method is run.

Overrides MigrateDrupalTestBase::setUp

File

core/modules/comment/src/Tests/Migrate/MigrateCommentStubTest.php, line 33
Contains \Drupal\comment\Tests\Migrate\MigrateCommentStubTest.

Class

MigrateCommentStubTest
Test stub creation for comment entities.

Namespace

Drupal\comment\Tests\Migrate

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('comment');
  $this
    ->installEntitySchema('node');

  // Make sure uid 0 is created (default uid for comments is 0).
  $storage = \Drupal::entityManager()
    ->getStorage('user');

  // Insert a row for the anonymous user.
  $storage
    ->create(array(
    'uid' => 0,
    'status' => 0,
    'name' => '',
  ))
    ->save();

  // Need at least one node type and comment type present.
  NodeType::create([
    'type' => 'testnodetype',
    'name' => 'Test node type',
  ])
    ->save();
  CommentType::create([
    'id' => 'testcommenttype',
    'label' => 'Test comment type',
    'target_entity_type_id' => 'node',
  ])
    ->save();
}