function QueueTest::queueScore

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php \Drupal\KernelTests\Core\Queue\QueueTest::queueScore()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php \Drupal\KernelTests\Core\Queue\QueueTest::queueScore()
  3. 11.x core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php \Drupal\KernelTests\Core\Queue\QueueTest::queueScore()

Returns the number of equal items in two arrays.

1 call to QueueTest::queueScore()
QueueTest::runQueueTest in core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php
Queues and unqueues a set of items to check the basic queue functionality.

File

core/tests/Drupal/KernelTests/Core/Queue/QueueTest.php, line 110

Class

QueueTest
Queues and unqueues a set of items to check the basic queue functionality.

Namespace

Drupal\KernelTests\Core\Queue

Code

protected function queueScore($items, $new_items) {
    $score = 0;
    foreach ($items as $item) {
        foreach ($new_items as $new_item) {
            if ($item === $new_item) {
                $score++;
            }
        }
    }
    return $score;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.