MigrateCommentFieldTest.php in Drupal 10
File
core/modules/comment/tests/src/Kernel/Migrate/d6/MigrateCommentFieldTest.php
View source
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d6;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\migrate_drupal\Kernel\d6\MigrateDrupal6TestBase;
class MigrateCommentFieldTest extends MigrateDrupal6TestBase {
protected static $modules = [
'comment',
'menu_ui',
];
protected function setUp() : void {
parent::setUp();
$this
->installConfig([
'comment',
]);
$this
->executeMigrations([
'd6_comment_type',
'd6_comment_field',
]);
}
protected function assertEntity(string $comment_type) : void {
$entity = FieldStorageConfig::load('node.' . $comment_type);
$this
->assertInstanceOf(FieldStorageConfig::class, $entity);
$this
->assertSame('node', $entity
->getTargetEntityTypeId());
$this
->assertSame('comment', $entity
->getType());
$this
->assertSame($comment_type, $entity
->getSetting('comment_type'));
}
public function testMigration() {
$this
->assertEntity('comment_node_article');
$this
->assertEntity('comment_node_company');
$this
->assertEntity('comment_node_employee');
$this
->assertEntity('comment_node_event');
$this
->assertEntity('comment_forum');
$this
->assertEntity('comment_node_page');
$this
->assertEntity('comment_node_sponsor');
$this
->assertEntity('comment_node_story');
$this
->assertEntity('comment_node_test_event');
$this
->assertEntity('comment_node_test_page');
$this
->assertEntity('comment_node_test_planet');
$this
->assertEntity('comment_node_test_story');
}
}