function TermTest::testParentHandlerSettings

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

File

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

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.