You are here

public function MigrateCommentTypeTest::testMigration in Drupal 10

Same name in this branch
  1. 10 core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php \Drupal\Tests\comment\Kernel\Migrate\d6\MigrateCommentTypeTest::testMigration()
  2. 10 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentTypeTest::testMigration()
Same name and namespace in other branches
  1. 8 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentTypeTest::testMigration()
  2. 9 core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php \Drupal\Tests\comment\Kernel\Migrate\d7\MigrateCommentTypeTest::testMigration()

Tests the migrated comment types.

File

core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTypeTest.php, line 41

Class

MigrateCommentTypeTest
Tests the migration of comment types from Drupal 7.

Namespace

Drupal\Tests\comment\Kernel\Migrate\d7

Code

public function testMigration() {
  $this
    ->migrateCommentTypes();
  $comment_fields = [
    'comment' => 'Default comment setting',
    'comment_default_mode' => 'Default display mode',
    'comment_default_per_page' => 'Default comments per page',
    'comment_anonymous' => 'Anonymous commenting',
    'comment_subject_field' => 'Comment subject field',
    'comment_preview' => 'Preview comment',
    'comment_form_location' => 'Location of comment submission form',
  ];
  foreach ($comment_fields as $field => $description) {
    $this
      ->assertEquals($description, $this->migration
      ->getSourcePlugin()
      ->fields()[$field]);
  }
  $this
    ->assertEntity('comment_node_article', 'Article comment');
  $this
    ->assertEntity('comment_node_blog', 'Blog entry comment');
  $this
    ->assertEntity('comment_node_book', 'Book page comment');
  $this
    ->assertEntity('comment_forum', 'Forum topic comment');
  $this
    ->assertEntity('comment_node_page', 'Basic page comment');
  $this
    ->assertEntity('comment_node_test_content_type', 'Test content type comment');
  $this
    ->assertEntity('comment_node_a_thirty_two_char', 'Test long name comment');
}