MigrateCommentTypeTest.php in Zircon Profile 8
File
core/modules/comment/src/Tests/Migrate/d7/MigrateCommentTypeTest.php
View source
<?php
namespace Drupal\comment\Tests\Migrate\d7;
use Drupal\comment\CommentTypeInterface;
use Drupal\comment\Entity\CommentType;
use Drupal\migrate\Entity\Migration;
use Drupal\migrate_drupal\Tests\d7\MigrateDrupal7TestBase;
class MigrateCommentTypeTest 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',
]);
}
protected function assertEntity($id, $label) {
$entity = CommentType::load($id);
$this
->assertTrue($entity instanceof CommentTypeInterface);
$this
->assertIdentical($label, $entity
->label());
$this
->assertIdentical('node', $entity
->getTargetEntityTypeId());
}
public function testMigration() {
$this
->assertEntity('comment_node_page', 'Basic page comment');
$this
->assertEntity('comment_node_article', 'Article comment');
$this
->assertEntity('comment_node_blog', 'Blog entry comment');
$this
->assertEntity('comment_node_book', 'Book page comment');
$this
->assertEntity('comment_node_forum', 'Forum topic comment');
$this
->assertEntity('comment_node_test_content_type', 'Test content type comment');
$migration = Migration::load('d7_comment_type');
$this
->assertIdentical($migration
->getSourcePlugin()
->count(), $migration
->getIdMap()
->processedCount());
}
}