You are here

public function ScheduledTransitionsUtilityTest::testGetBundles 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::testGetBundles()

Tests enabled bundles helper.

@covers ::getBundles

File

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

Class

ScheduledTransitionsUtilityTest
Tests scheduled transactions utility.

Namespace

Drupal\Tests\scheduled_transitions\Kernel

Code

public function testGetBundles() : 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
    ->getBundles();
  $this
    ->assertEquals([], $result);
  $this
    ->enabledBundles([
    [
      'entity_test_revlog',
      'entity_test_revlog',
    ],
  ]);
  Cache::invalidateTags([
    SettingsForm::SETTINGS_TAG,
  ]);
  $result = $scheduledTransitionsUtility
    ->getBundles();
  $this
    ->assertEquals([
    'entity_test_revlog' => [
      'entity_test_revlog',
    ],
  ], $result);
}