You are here

public function ScheduledTransitionsCronUnitTest::testCronOff in Scheduled Transitions 8

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

Tests not creating queue items during cron.

@covers ::cron

File

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

Class

ScheduledTransitionsCronUnitTest
Tests cron hooks.

Namespace

Drupal\Tests\scheduled_transitions\Unit

Code

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