From dca3ac8cbeea984a1d5d287d7d5d3fa5c1316bb8 Mon Sep 17 00:00:00 2001 From: Dave Long Date: Mon, 22 Jul 2024 12:26:12 +0100 Subject: [PATCH] Issue #3305609 by pooja_sharma, joachim: convert TermTest::testParentHandlerSettings() into a kernel test --- .../modules/taxonomy/tests/src/Functional/TermTest.php | 9 --------- .../taxonomy/tests/src/Kernel/TermKernelTest.php | 10 ++++++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php index f3abdb53272..5ecd6d2c8c1 100644 --- a/core/modules/taxonomy/tests/src/Functional/TermTest.php +++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php @@ -89,15 +89,6 @@ class TermTest extends TaxonomyTestBase { ->save(); } - /** - * The "parent" field must restrict references to the same vocabulary. - */ - public function testParentHandlerSettings(): void { - $vocabulary_fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('taxonomy_term', $this->vocabulary->id()); - $parent_target_bundles = $vocabulary_fields['parent']->getSetting('handler_settings')['target_bundles']; - $this->assertSame([$this->vocabulary->id() => $this->vocabulary->id()], $parent_target_bundles); - } - /** * Tests terms in a single and multiple hierarchy. */ diff --git a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php index c49bdef2fb1..12600f30dde 100644 --- a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php +++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php @@ -196,4 +196,14 @@ class TermKernelTest extends KernelTestBase { $this->assertFalse($entity->get('revision_log_message')->access('view', $viewer)); } + /** + * The "parent" field must restrict references to the same vocabulary. + */ + public function testParentHandlerSettings(): void { + $vocabulary = $this->createVocabulary(); + $vocabulary_fields = \Drupal::service('entity_field.manager')->getFieldDefinitions('taxonomy_term', $vocabulary->id()); + $parent_target_bundles = $vocabulary_fields['parent']->getSetting('handler_settings')['target_bundles']; + $this->assertSame([$vocabulary->id() => $vocabulary->id()], $parent_target_bundles); + } + }