X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd7%2FMigrateCommentTest.php;h=95717ed352d005cfc12620c4abd569342eb1f389;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=42c2a308bb305924d052310450cfc17c0c20cf83;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php b/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php index 42c2a308b..95717ed35 100644 --- a/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php +++ b/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentTest.php @@ -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()); } }