MigrateCommentFieldTest.php in Drupal 9
File
core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php
View source
<?php
namespace Drupal\Tests\comment\Kernel\Migrate\d7;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
class MigrateCommentFieldTest extends MigrateDrupal7TestBase {
protected static $modules = [
'node',
'comment',
'text',
];
protected function setUp() : void {
parent::setUp();
$this
->migrateCommentTypes();
$this
->executeMigration('d7_comment_field');
}
protected function assertEntity($comment_type) {
$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_page');
$this
->assertEntity('comment_node_article');
$this
->assertEntity('comment_node_blog');
$this
->assertEntity('comment_node_book');
$this
->assertEntity('comment_forum');
$this
->assertEntity('comment_node_test_content_type');
$this
->assertEntity('comment_node_et');
}
}