// Ensure that the queues are of the correct type for this test.
$this->
assertInstanceOf('Drupal\Core\Queue\DelayableQueueInterface',
$database);
$this->
assertNotInstanceOf('Drupal\Core\Queue\DelayableQueueInterface',
$memory);
// Get the queue worker plugin manager.
$manager =
$this->container->
get('plugin.manager.queue_worker'
);
$definitions =
$manager->
getDefinitions();
$this->
assertNotEmpty($database_lease_time =
$definitions['cron_queue_test_database_delay_exception'
]['cron'
]['time'
]);
$this->
assertNotEmpty($memory_lease_time =
$definitions['cron_queue_test_memory_delay_exception'
]['cron'
]['time'
]);
// Create the necessary test data and run cron.
$database->
createItem('test'
);
$memory->
createItem('test'
);
$this->cron->
run();
// Fetch the expiry time for the database queue.
$query =
$this->connection->
select('queue'
);
$query->
condition('name', 'cron_queue_test_database_delay_exception'
);
$query->
addField('queue', 'expire'
);
$query->
range(0, 1
);
$expire =
$query->
execute()->
fetchField();
// Assert that the delay interval is greater than the lease interval. This