function EntityDisplayDependenciesTest::assertDisplayDependencies

Asserts that a display has all dependencies from its fields.

Parameters

array $dependent_fields: An array of field names to configure on the display, mapped to module names to be used as dependencies.

\Drupal\Core\Entity\Display\EntityDisplayInterface $display: An entity display to configure and test.

File

core/modules/field_ui/tests/src/Kernel/EntityDisplayDependenciesTest.php, line 126

Class

EntityDisplayDependenciesTest
Tests dependencies of entity displays.

Namespace

Drupal\Tests\field_ui\Kernel

Code

protected function assertDisplayDependencies(array $dependent_fields, EntityDisplayInterface $display) : void {
  $dependencies = $display->calculateDependencies()
    ->getDependencies();
  foreach ($dependent_fields as $module) {
    $this->assertContains($module, $dependencies['module']);
  }
}

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