You are here

public function DynamicEntityReferenceFieldDependencyTest::testFieldDependenciesExclude 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::testFieldDependenciesExclude()

Test dependencies when there is entity type exclusion.

File

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

Class

DynamicEntityReferenceFieldDependencyTest
Tests for dynamic entity reference field dependencies.

Namespace

Drupal\Tests\dynamic_entity_reference\Kernel

Code

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

  // Expected module dependencies.
  $module_dependencies = $this->entityTypeProviders;
  $module_dependencies[] = 'dynamic_entity_reference';

  // Remove entity_test_provider.
  $module_dependencies = array_diff($module_dependencies, [
    'dynamic_entity_reference_test_entity_provider',
  ]);
  $this
    ->assertEqualsCanonicalizing([
    'module' => $module_dependencies,
  ], $this->fieldStorage
    ->getDependencies());
}