You are here

public function TermTest::testParentHandlerSettings in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/taxonomy/tests/src/Functional/TermTest.php \Drupal\Tests\taxonomy\Functional\TermTest::testParentHandlerSettings()
  2. 9 core/modules/taxonomy/tests/src/Functional/TermTest.php \Drupal\Tests\taxonomy\Functional\TermTest::testParentHandlerSettings()

The "parent" field must restrict references to the same vocabulary.

File

core/modules/taxonomy/tests/src/Functional/TermTest.php, line 90

Class

TermTest
Tests load, save and delete for taxonomy terms.

Namespace

Drupal\Tests\taxonomy\Functional

Code

public function testParentHandlerSettings() {
  $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);
}