X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd7%2FMigrateCommentFieldTest.php;fp=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FKernel%2FMigrate%2Fd7%2FMigrateCommentFieldTest.php;h=aa59f678f7f9a4a1f84695747713e4106b568d21;hp=b995bdb0a532233f1a4dc707cb59a7379cc5a76e;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php b/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php index b995bdb0a..aa59f678f 100644 --- a/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php +++ b/web/core/modules/comment/tests/src/Kernel/Migrate/d7/MigrateCommentFieldTest.php @@ -3,27 +3,28 @@ namespace Drupal\Tests\comment\Kernel\Migrate\d7; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\field\FieldStorageConfigInterface; use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; /** - * Tests creation of comment reference fields for each comment type defined - * in Drupal 7. + * Tests the migration of comment fields from Drupal 7. * * @group comment + * @group migrate_drupal_7 */ class MigrateCommentFieldTest extends MigrateDrupal7TestBase { - public static $modules = ['node', 'comment', 'text', 'menu_ui']; + /** + * {@inheritdoc} + */ + public static $modules = ['node', 'comment', 'text']; /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); - $this->installConfig(static::$modules); + $this->installConfig(['comment']); $this->executeMigrations([ - 'd7_node_type', 'd7_comment_type', 'd7_comment_field', ]); @@ -32,30 +33,27 @@ class MigrateCommentFieldTest extends MigrateDrupal7TestBase { /** * Asserts a comment field entity. * - * @param string $id - * The entity ID. * @param string $comment_type - * The comment type (bundle ID) the field references. + * The comment type. */ - protected function assertEntity($id, $comment_type) { - $entity = FieldStorageConfig::load($id); - $this->assertTrue($entity instanceof FieldStorageConfigInterface); - /** @var \Drupal\field\FieldStorageConfigInterface $entity */ - $this->assertIdentical('node', $entity->getTargetEntityTypeId()); - $this->assertIdentical('comment', $entity->getType()); - $this->assertIdentical($comment_type, $entity->getSetting('comment_type')); + 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')); } /** - * Tests the migrated fields. + * Tests the migrated comment fields. */ 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'); + $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'); } }