You are here

protected function CalculateDependenciesEventDispatcherTrait::dispatchCalculateDependencies in Dependency Calculation 8

Dispatches dependency calculation event.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity to use in the event.

Return value

\Drupal\depcalc\Event\CalculateEntityDependenciesEvent The event.

Throws

\Exception

4 calls to CalculateDependenciesEventDispatcherTrait::dispatchCalculateDependencies()
EntityViewDisplayDependencyCollectorTest::testEntityViewDisplaysWereAdded in tests/src/Kernel/EventSubscriber/DependencyCollector/EntityViewDisplayDependencyCollectorTest.php
@covers ::onCalculateDependencies
TermParentCollectorTest::testParentWasAdded in tests/src/Kernel/EventSubscriber/DependencyCollector/TermParentCollectorTest.php
@covers ::onCalculateDependencies
TextItemFieldDependencyCollectorTest::testFieldsAndEditorWereAddedAsDependencies in tests/src/Kernel/EventSubscriber/DependencyCollector/TextItemFieldDependencyCollectorTest.php
@covers ::onCalculateDependencies
WorkflowCollectorTest::testEntityHasModerationInfoDependency in tests/src/Kernel/EventSubscriber/DependencyCollector/WorkflowCollectorTest.php
@covers ::onCalculateDependencies

File

tests/src/Kernel/EventSubscriber/DependencyCollector/CalculateDependenciesEventDispatcherTrait.php, line 27

Class

CalculateDependenciesEventDispatcherTrait
Provides a method to dispatch calculate dependencies event.

Namespace

Drupal\Tests\depcalc\Kernel\EventSubscriber\DependencyCollector

Code

protected function dispatchCalculateDependencies(EntityInterface $entity) : CalculateEntityDependenciesEvent {
  $wrapper = new DependentEntityWrapper($entity);
  $dependencies = new DependencyStack();
  $event = new CalculateEntityDependenciesEvent($wrapper, $dependencies);
  $this->container
    ->get('event_dispatcher')
    ->dispatch(DependencyCalculatorEvents::CALCULATE_DEPENDENCIES, $event);
  return $event;
}