diff --git a/core/modules/comment/src/Entity/CommentType.php b/core/modules/comment/src/Entity/CommentType.php index 5289c42..487cca0 100644 --- a/core/modules/comment/src/Entity/CommentType.php +++ b/core/modules/comment/src/Entity/CommentType.php @@ -98,8 +98,9 @@ public function getTargetEntityTypeId() { */ public function calculateDependencies() { parent::calculateDependencies(); - $target_entity_type = \Drupal::entityTypeManager()->getDefinition($this->target_entity_type_id); + $target_entity_type = \Drupal::entityTypeManager()->getDefinition($this->getTargetEntityTypeId()); $this->addDependency('module', $target_entity_type->getProvider()); return $this; } + } diff --git a/core/modules/comment/src/Tests/CommentTypeTest.php b/core/modules/comment/src/Tests/CommentTypeTest.php index 1166931..656ba2d 100644 --- a/core/modules/comment/src/Tests/CommentTypeTest.php +++ b/core/modules/comment/src/Tests/CommentTypeTest.php @@ -188,14 +188,14 @@ public function testCommentTypeDeletion() { } /** - * Tests that the module providing the target entity is listed as a dependency + * Tests that the provider of the target entity is listed as a dependency. */ public function testCalculateDependencies() { // Create a comment type programmatically. - $type = $this->createCommentType('dep_test'); - $target_entity_type = \Drupal::entityTypeManager()->getDefinition($type->getTargetEntityTypeId()); - $dependencies = $type->calculateDependencies()->getDependencies(); - $this->assertTrue(in_array($target_entity_type->getProvider(), $dependencies['module']), 'Module dependency was found.'); + $comment_type = $this->createCommentType('dep_test'); + $target_entity_type = \Drupal::entityTypeManager()->getDefinition($comment_type->getTargetEntityTypeId()); + $dependencies = $comment_type->getDependencies() + ['module' => []]; + $this->assertTrue(in_array($target_entity_type->getProvider(), $dependencies['module'])); } } diff --git a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php index 65d0fb4..12fc44c 100644 --- a/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php +++ b/core/modules/field/tests/src/Kernel/Migrate/d7/MigrateFieldFormatterSettingsTest.php @@ -41,26 +41,32 @@ protected function setUp() { CommentType::create([ 'id' => 'comment_node_page', 'label' => $this->randomMachineName(), + 'target_entity_type_id' => 'node', ])->save(); CommentType::create([ 'id' => 'comment_node_article', 'label' => $this->randomMachineName(), + 'target_entity_type_id' => 'node', ])->save(); CommentType::create([ 'id' => 'comment_node_blog', 'label' => $this->randomMachineName(), + 'target_entity_type_id' => 'node', ])->save(); CommentType::create([ 'id' => 'comment_node_book', 'label' => $this->randomMachineName(), + 'target_entity_type_id' => 'node', ])->save(); CommentType::create([ 'id' => 'comment_node_forum', 'label' => $this->randomMachineName(), + 'target_entity_type_id' => 'node', ])->save(); CommentType::create([ 'id' => 'comment_node_test_content_type', 'label' => $this->randomMachineName(), + 'target_entity_type_id' => 'node', ])->save(); NodeType::create([