MigrateCommentTypeTest.php in Drupal 8
File
core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentTypeTest.php
View source
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\comment\Entity\CommentType;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateCommentTypeTest extends MigrateDrupal6TestBase {
public static $modules = [
'comment',
];
protected function setUp() {
parent::setUp();
$this
->installConfig([
'comment',
]);
$this
->executeMigration('d6_comment_type');
}
protected function assertEntity($id, $label) {
$entity = CommentType::load($id);
$this
->assertInstanceOf(CommentType::class, $entity);
$this
->assertSame($label, $entity
->label());
$this
->assertSame('node', $entity
->getTargetEntityTypeId());
}
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');
}
}