private function addTestsToBatchSet(&$batches, $tests, $maxBatchSize)
{
foreach ($tests as $test) {
$lastIndex = count($batches) - 1;
if ($lastIndex != -1 && count($batches[$lastIndex]) < $maxBatchSize) {
$batches[$lastIndex][] = $test;
} else {
$batches[] = array($test);
}
}
}