You are here

public function ScheduledTransitionsCronUnitTest::testCronOn in Scheduled Transitions 2.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/ScheduledTransitionsCronUnitTest.php \Drupal\Tests\scheduled_transitions\Unit\ScheduledTransitionsCronUnitTest::testCronOn()

Tests creating queue items during cron.

@covers ::cron

File

tests/src/Unit/ScheduledTransitionsCronUnitTest.php, line 49

Class

ScheduledTransitionsCronUnitTest
Tests cron hooks.

Namespace

Drupal\Tests\scheduled_transitions\Unit

Code

public function testCronOn() : void {
  $testConfig = $this
    ->createMock(ImmutableConfig::class);
  $testConfig
    ->expects($this
    ->once())
    ->method('get')
    ->with('automation.cron_create_queue_items')
    ->willReturn(TRUE);
  $this->testConfigFactory
    ->expects($this
    ->once())
    ->method('get')
    ->with('scheduled_transitions.settings')
    ->willReturn($testConfig);
  $this->testJobs
    ->expects($this
    ->once())
    ->method('jobCreator');
  $hooksService = new ScheduledTransitionsHooks($this->testConfigFactory, $this->testJobs);
  $hooksService
    ->cron();
}