X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd6%2FMigrateCommentTypeTest.php;h=2fa60826de298d38500b54aff9a9cc54af5148db;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=c28be63b977ed60da6c5c8f8498a3a8859f24706;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php b/web/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php index c28be63b9..2fa60826d 100644 --- a/web/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php +++ b/web/core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php @@ -6,8 +6,9 @@ use Drupal\comment\Entity\CommentType; use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase; /** - * Upgrade comment type. + * Tests the migration of comment types from Drupal 6. * + * @group comment * @group migrate_drupal_6 */ class MigrateCommentTypeTest extends MigrateDrupal6TestBase { @@ -22,20 +23,41 @@ class MigrateCommentTypeTest extends MigrateDrupal6TestBase { */ protected function setUp() { parent::setUp(); - $this->installEntitySchema('node'); - $this->installEntitySchema('comment'); - $this->installConfig(['node', 'comment']); + $this->installConfig(['comment']); $this->executeMigration('d6_comment_type'); } /** - * Tests the Drupal 6 to Drupal 8 comment type migration. + * Asserts a comment type entity. + * + * @param string $id + * The entity ID. + * @param string $label + * The entity label. */ - public function testCommentType() { - $comment_type = CommentType::load('comment'); - $this->assertIdentical('node', $comment_type->getTargetEntityTypeId()); - $comment_type = CommentType::load('comment_no_subject'); - $this->assertIdentical('node', $comment_type->getTargetEntityTypeId()); + protected function assertEntity($id, $label) { + $entity = CommentType::load($id); + $this->assertInstanceOf(CommentType::class, $entity); + $this->assertSame($label, $entity->label()); + $this->assertSame('node', $entity->getTargetEntityTypeId()); + } + + /** + * Tests the migrated comment types. + */ + public function testMigration() { + $this->assertEntity('comment_node_article', 'Article comment'); + $this->assertEntity('comment_node_company', 'Company comment'); + $this->assertEntity('comment_node_employee', 'Employee comment'); + $this->assertEntity('comment_node_event', 'Event comment'); + $this->assertEntity('comment_forum', 'Forum topic comment'); + $this->assertEntity('comment_node_page', 'Page comment'); + $this->assertEntity('comment_node_sponsor', 'Sponsor comment'); + $this->assertEntity('comment_node_story', 'Story comment'); + $this->assertEntity('comment_node_test_event', 'Migrate test event comment'); + $this->assertEntity('comment_node_test_page', 'Migrate test page comment'); + $this->assertEntity('comment_node_test_planet', 'Migrate test planet comment'); + $this->assertEntity('comment_node_test_story', 'Migrate test story comment'); } }