Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / comment / tests / src / Kernel / Migrate / d7 / MigrateCommentTest.php
index 42c2a308bb305924d052310450cfc17c0c20cf83..95717ed352d005cfc12620c4abd569342eb1f389 100644 (file)
@@ -2,18 +2,21 @@
 
 namespace Drupal\Tests\comment\Kernel\Migrate\d7;
 
-use Drupal\comment\CommentInterface;
 use Drupal\comment\Entity\Comment;
 use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase;
 use Drupal\node\NodeInterface;
 
 /**
- * Tests migration of comments from Drupal 7.
+ * Tests the migration of comments from Drupal 7.
  *
  * @group comment
+ * @group migrate_drupal_7
  */
 class MigrateCommentTest extends MigrateDrupal7TestBase {
 
+  /**
+   * {@inheritdoc}
+   */
   public static $modules = ['filter', 'node', 'comment', 'text', 'menu_ui'];
 
   /**
@@ -22,50 +25,44 @@ class MigrateCommentTest extends MigrateDrupal7TestBase {
   protected function setUp() {
     parent::setUp();
 
-    $this->installConfig(static::$modules);
     $this->installEntitySchema('node');
     $this->installEntitySchema('comment');
+    $this->installConfig(['comment', 'node']);
+    $this->installSchema('comment', ['comment_entity_statistics']);
 
     $this->executeMigrations([
-      'd7_filter_format',
       'd7_user_role',
       'd7_user',
-    ]);
-    $this->executeMigration('d7_node_type');
-    // We only need the test_content_type node migration to run for real, so
-    // mock all the others.
-    $this->prepareMigrations([
-      'd7_node' => [
-        [[0], [0]],
-      ],
-    ]);
-    $this->executeMigrations([
+      'd7_node_type',
       'd7_node',
       'd7_comment_type',
+      'd7_comment_field',
+      'd7_comment_field_instance',
+      'd7_comment_entity_display',
+      'd7_comment_entity_form_display',
       'd7_comment',
     ]);
   }
 
   /**
-   * Tests migration of comments from Drupal 7.
+   * Tests the migrated comments.
    */
-  public function testCommentMigration() {
+  public function testMigration() {
     $comment = Comment::load(1);
-    $this->assertTrue($comment instanceof CommentInterface);
-    /** @var \Drupal\comment\CommentInterface $comment */
-    $this->assertIdentical('A comment', $comment->getSubject());
-    $this->assertIdentical('1421727536', $comment->getCreatedTime());
-    $this->assertIdentical('1421727536', $comment->getChangedTime());
+    $this->assertInstanceOf(Comment::class, $comment);
+    $this->assertSame('A comment', $comment->getSubject());
+    $this->assertSame('1421727536', $comment->getCreatedTime());
+    $this->assertSame('1421727536', $comment->getChangedTime());
     $this->assertTrue($comment->getStatus());
-    $this->assertIdentical('admin', $comment->getAuthorName());
-    $this->assertIdentical('admin@local.host', $comment->getAuthorEmail());
-    $this->assertIdentical('This is a comment', $comment->comment_body->value);
-    $this->assertIdentical('filtered_html', $comment->comment_body->format);
-    $this->assertEquals('2001:db8:ffff:ffff:ffff:ffff:ffff:ffff', $comment->getHostname());
+    $this->assertSame('admin', $comment->getAuthorName());
+    $this->assertSame('admin@local.host', $comment->getAuthorEmail());
+    $this->assertSame('This is a comment', $comment->comment_body->value);
+    $this->assertSame('filtered_html', $comment->comment_body->format);
+    $this->assertSame('2001:db8:ffff:ffff:ffff:ffff:ffff:ffff', $comment->getHostname());
 
     $node = $comment->getCommentedEntity();
-    $this->assertTrue($node instanceof NodeInterface);
-    $this->assertIdentical('1', $node->id());
+    $this->assertInstanceOf(NodeInterface::class, $node);
+    $this->assertSame('1', $node->id());
   }
 
 }