protected function AssertQueueTrait::getQueueSize in Helper 8
Retrieves the number of items in the queue, always as an integer.
This was used in earlier versions of Drupal 8 since queues that used a DatabaseQueue backend returned strings, which was unhelpful when needing to assert identical values with an integer. This has been fixed as of Drupal 8.6.
Parameters
string $queue_name: The queue name.
Return value
int The number of items in the queue.
Deprecated
in helper:8.x-1.4 and is removed from helper:2.0.0 Use \Drupal\Core\Queue\QueueInterface::numberOfItems() instead.
See also
https://www.drupal.org/node/2835989
File
- src/
Tests/ AssertQueueTrait.php, line 32
Class
- AssertQueueTrait
- Provides assertions for running queues.
Namespace
Drupal\helper\TestsCode
protected function getQueueSize($queue_name) {
@trigger_error('AssertQueueTrait::getQueueSize() is deprecated in helper:8.x-1.4 and is removed from helper:2.0.0. Use \\Drupal::queue($queue_name)->numberOfItems() instead. See https://www.drupal.org/node/2835989', E_USER_DEPRECATED);
return \Drupal::queue($queue_name)
->numberOfItems();
}