You are here

public function WorkflowCollectorTest::testEntityHasModerationInfoDependency in Dependency Calculation 8

@covers ::onCalculateDependencies

Throws

\Exception

File

tests/src/Kernel/EventSubscriber/DependencyCollector/WorkflowCollectorTest.php, line 66

Class

WorkflowCollectorTest
Class WorkflowCollectorTest.

Namespace

Drupal\Tests\depcalc\Kernel\EventSubscriber\DependencyCollector

Code

public function testEntityHasModerationInfoDependency() {
  $workflow = $this
    ->createEditorialWorkflow();
  NodeType::create([
    'name' => 'Moderation type',
    'type' => 'moderation_type',
  ])
    ->save();
  $entity = Node::create([
    'type' => 'moderation_type',
    'title' => 'New node 1',
  ]);
  $entity
    ->save();
  $this
    ->addEntityTypeAndBundleToWorkflow($workflow, $entity
    ->getEntityTypeId(), $entity
    ->bundle());
  $event = $this
    ->dispatchCalculateDependencies($entity);
  $dependencies = $event
    ->getDependencies();
  $this
    ->assertArrayHasKey($workflow
    ->uuid(), $dependencies);
}