You are here

public function TermTest::testParentHandlerSettings in Drupal 8

Same name and namespace in other branches
  1. 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 88

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
    ->assertIdentical([
    $this->vocabulary
      ->id() => $this->vocabulary
      ->id(),
  ], $parent_target_bundles);
}