/**
* Test safeguard against invalid annotations in QueueWorkerManager.
*/
public function testQueueWorkerManagerSafeguard(): void
{ $queue_worker_manager =
$this->container->
get('plugin.manager.queue_worker'
);
$plugin_id = 'test_plugin_id';
// Ensure if no cron annotation is provided, none is added.
$definition =
[];
$queue_worker_manager->
processDefinition($definition,
$plugin_id);
$this->
assertArrayNotHasKey('cron',
$definition);
// Ensure if an empty cron annotation is provided, the default lease time is
// added.
$definition =
['cron' =>
[]];
$queue_worker_manager->
processDefinition($definition,
$plugin_id);
$this->
assertArrayHasKey('time',
$definition['cron'
]);
$this->
assertEquals(QueueWorkerManagerInterface::DEFAULT_QUEUE_CRON_TIME,
$definition['cron'
]['time'
]);
// Ensure if an invalid lease time (less-than 1 second) is provided, it is
// overridden with the default lease time.