You are here

protected function ViewsModerationStateFilterTest::assertWorkflowDependencies in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php \Drupal\Tests\content_moderation\Functional\ViewsModerationStateFilterTest::assertWorkflowDependencies()

Asserts the views dependencies on workflow config entities.

Parameters

string[] $workflow_ids: An array of workflow IDs to check.

\Drupal\views\ViewEntityInterface $view: A view configuration object.

1 call to ViewsModerationStateFilterTest::assertWorkflowDependencies()
ViewsModerationStateFilterTest::testModerationStateFilterDependencyHandling in core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php
Tests the dependency handling of the moderation state filter.

File

core/modules/content_moderation/tests/src/Functional/ViewsModerationStateFilterTest.php, line 359

Class

ViewsModerationStateFilterTest
Tests the views 'moderation_state_filter' filter plugin.

Namespace

Drupal\Tests\content_moderation\Functional

Code

protected function assertWorkflowDependencies(array $workflow_ids, ViewEntityInterface $view) {
  $dependencies = $view
    ->getDependencies();
  $expected = [];
  foreach (Workflow::loadMultiple($workflow_ids) as $workflow) {
    $expected[] = $workflow
      ->getConfigDependencyName();
  }
  if ($expected) {
    $this
      ->assertSame($expected, $dependencies['config']);
  }
  else {
    $this
      ->assertTrue(!isset($dependencies['config']));
  }
}