You are here

private function EntityFormDisplayDependencyCollectorTest::createFormDisplay in Dependency Calculation 8

Creates a form display for a given entity type.

Parameters

string $targetEntityType: Target entity type.

string $bundle: Bundle name.

string $mode: Form mode name.

bool $status: Publishing status.

Return value

\Drupal\Core\Entity\EntityInterface Form display.

Throws

\Drupal\Core\Entity\EntityStorageException

1 call to EntityFormDisplayDependencyCollectorTest::createFormDisplay()
EntityFormDisplayDependencyCollectorTest::testEntityFormDisplayDependencyCollection in tests/src/Kernel/EventSubscriber/DependencyCollector/EntityFormDisplayDependencyCollectorTest.php
Tests dependency calculation of entity form display.

File

tests/src/Kernel/EventSubscriber/DependencyCollector/EntityFormDisplayDependencyCollectorTest.php, line 119

Class

EntityFormDisplayDependencyCollectorTest
Class EntityFormDisplayDependencyCollectorTest.

Namespace

Drupal\Tests\depcalc\Kernel\EventSubscriber\DependencyCollector

Code

private function createFormDisplay(string $targetEntityType, string $bundle, string $mode, bool $status) {
  EntityFormMode::create([
    'id' => sprintf('%s.%s', $targetEntityType, $mode),
    'targetEntityType' => $targetEntityType,
    'bundle' => $bundle,
    'mode' => $mode,
  ])
    ->save();
  $formDisplay = EntityFormDisplay::create([
    'targetEntityType' => $targetEntityType,
    'bundle' => $bundle,
    'mode' => $mode,
    'status' => $status,
  ]);
  $formDisplay
    ->save();
  return $formDisplay;
}