You are here

public function DynamicEntityReferenceFieldDependencyTest::testFieldDependenciesStrict in Dynamic Entity Reference 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/DynamicEntityReferenceFieldDependencyTest.php \Drupal\Tests\dynamic_entity_reference\Kernel\DynamicEntityReferenceFieldDependencyTest::testFieldDependenciesStrict()

Test dependencies when entity types are strictly defined.

File

tests/src/Kernel/DynamicEntityReferenceFieldDependencyTest.php, line 107

Class

DynamicEntityReferenceFieldDependencyTest
Tests for dynamic entity reference field dependencies.

Namespace

Drupal\Tests\dynamic_entity_reference\Kernel

Code

public function testFieldDependenciesStrict() {
  $this->fieldStorage
    ->setSetting('exclude_entity_types', FALSE);
  $this->fieldStorage
    ->setSetting('entity_type_ids', [
    'entity_test_provider',
  ]);
  $this->fieldStorage
    ->save();

  // Expected module dependencies.
  $module_dependencies[] = 'entity_test';
  $module_dependencies[] = 'dynamic_entity_reference_test_entity_provider';
  $module_dependencies[] = 'dynamic_entity_reference';
  $this
    ->assertEqualsCanonicalizing([
    'module' => $module_dependencies,
  ], $this->fieldStorage
    ->getDependencies());
}