MigrateCommentFieldTest.php in Zircon Profile 8
File
core/modules/comment/src/Tests/Migrate/d7/MigrateCommentFieldTest.php
View source
<?php
namespace Drupal\comment\Tests\Migrate\d7;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\field\FieldStorageConfigInterface;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
class MigrateCommentFieldTest extends MigrateDrupal7TestBase {
public static $modules = [
'node',
'comment',
'text',
];
protected function setUp() {
parent::setUp();
$this
->installConfig(static::$modules);
$this
->executeMigrations([
'd7_node_type',
'd7_comment_type',
'd7_comment_field',
]);
}
protected function assertEntity($id, $comment_type) {
$entity = FieldStorageConfig::load($id);
$this
->assertTrue($entity instanceof FieldStorageConfigInterface);
$this
->assertIdentical('node', $entity
->getTargetEntityTypeId());
$this
->assertIdentical('comment', $entity
->getType());
$this
->assertIdentical($comment_type, $entity
->getSetting('comment_type'));
}
public function testMigration() {
$this
->assertEntity('node.comment_node_page', 'comment_node_page');
$this
->assertEntity('node.comment_node_article', 'comment_node_article');
$this
->assertEntity('node.comment_node_blog', 'comment_node_blog');
$this
->assertEntity('node.comment_node_book', 'comment_node_book');
$this
->assertEntity('node.comment_node_forum', 'comment_node_forum');
$this
->assertEntity('node.comment_node_test_content_type', 'comment_node_test_content_type');
}
}