function WorkAllocator::placeTestsIntoBins

Distribute tests into roughly equal sized bins.

Parameters

TestClassInfoList $tests: An array of test class names.

Return value

array<int,TestClassInfoList> An associative array of bins and the test class names in each bin.

1 call to WorkAllocator::placeTestsIntoBins()
WorkAllocator::process in core/tests/Drupal/TestTools/TestRunner/WorkAllocator.php
Allocates tests to workers.

File

core/tests/Drupal/TestTools/TestRunner/WorkAllocator.php, line 178

Class

WorkAllocator
Allocates available tests to test workers.

Namespace

Drupal\TestTools\TestRunner

Code

private function placeTestsIntoBins(array $tests) : array {
  $bins = array_fill(0, $this->totalBins, []);
  $i = 0;
  foreach ($tests as $key => $test) {
    $bins[$i++ % $this->totalBins][$key] = $test;
  }
  return $bins;
}

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