function WorkAllocatorTest::testEveryTestAllocatedOnce

Tests that every test is allocated to exactly one bin.

File

core/tests/Drupal/Tests/Core/Test/WorkAllocatorTest.php, line 66

Class

WorkAllocatorTest
Unit tests for WorkAllocator.

Namespace

Drupal\Tests\Core\Test

Code

public function testEveryTestAllocatedOnce() : void {
  $grouped = json_decode(file_get_contents(__DIR__ . '/../../../../fixtures/test_runner/work_allocator/complex_in.json'), TRUE);
  $expected = array_keys(array_merge(...array_values($grouped)));
  $allocated = [];
  for ($bin = 1; $bin <= 8; $bin++) {
    $allocated = array_merge($allocated, array_keys((new WorkAllocator($grouped, 8, $bin))->getAllocatedList()));
  }
  sort($expected);
  sort($allocated);
  $this->assertSame($expected, $allocated);
}

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