You are here

public function ScheduledTransitionsUtilityTest::testGetApplicableBundles in Scheduled Transitions 2.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/ScheduledTransitionsUtilityTest.php \Drupal\Tests\scheduled_transitions\Kernel\ScheduledTransitionsUtilityTest::testGetApplicableBundles()

Tests applicable bundles helper.

@covers ::getApplicableBundles

File

tests/src/Kernel/ScheduledTransitionsUtilityTest.php, line 51

Class

ScheduledTransitionsUtilityTest
Tests scheduled transactions utility.

Namespace

Drupal\Tests\scheduled_transitions\Kernel

Code

public function testGetApplicableBundles() : void {

  /** @var \Drupal\scheduled_transitions\ScheduledTransitionsUtilityInterface $scheduledTransitionsUtility */
  $scheduledTransitionsUtility = \Drupal::service('scheduled_transitions.utility');
  $result = $scheduledTransitionsUtility
    ->getApplicableBundles();
  $this
    ->assertEquals([], $result);
  $workflow = $this
    ->createEditorialWorkflow();
  $workflow
    ->getTypePlugin()
    ->addEntityTypeAndBundle('entity_test_revlog', 'entity_test_revlog');
  $workflow
    ->save();
  $result = $scheduledTransitionsUtility
    ->getApplicableBundles();
  $this
    ->assertEquals([
    'entity_test_revlog' => [
      'entity_test_revlog',
    ],
  ], $result);
}