if ($method_calls < self::REQUEUE_COUNT
) { \Drupal::
state()->
set('cron_test.requeue_count',
$method_calls + 1
);
throw new RequeueException();
} });
// Set the mock queue worker manager to return the definition/plugin.
$queue_worker_manager->
getDefinitions()->
willReturn([$queue_worker =>
$queue_worker_definition]);
$queue_worker_manager->
createInstance($queue_worker)->
willReturn($queue_worker_plugin->
reveal());
// Construct the Cron class to test.
$this->cron =
new Cron($module_handler->
reveal(),
$lock_backend->
reveal(),
$queue_factory->
reveal(),
$state->
reveal(),
$account_switcher->
reveal(),
$logger->
reveal(),
$queue_worker_manager->
reveal(),
$time->
reveal(),
$queueConfig);
} /**
* Resets the testing state.
*/
protected function resetTestingState() { $this->queue->
deleteQueue();
$this->state->
set('cron_test.message_logged', FALSE
);
$this->state->
set('cron_test.requeue_count', NULL
);
}