You are here

protected function CommentLegacyTest::setUp in Drupal 8

Overrides EntityKernelTestBase::setUp

File

core/modules/comment/tests/src/Kernel/CommentLegacyTest.php, line 38

Class

CommentLegacyTest
Tests legacy comment functionality.

Namespace

Drupal\Tests\comment\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('comment');
  $this
    ->installSchema('comment', [
    'comment_entity_statistics',
  ]);
  CommentType::create([
    'id' => 'comment',
    'label' => $this
      ->randomString(),
    'target_entity_type_id' => 'entity_test',
  ])
    ->save();
  FieldStorageConfig::create([
    'entity_type' => 'entity_test',
    'type' => 'comment',
    'field_name' => 'comments',
    'settings' => [
      'comment_type' => 'comment',
    ],
  ])
    ->save();
  FieldConfig::create([
    'entity_type' => 'entity_test',
    'bundle' => 'entity_test',
    'field_name' => 'comments',
  ])
    ->save();
  $this->entity = EntityTest::create([
    'name' => $this
      ->randomString(),
  ]);
  $this->entity
    ->save();
}