Skip to content

Commit

Permalink
Add test for tasks serialized to files
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexVanderbist committed Aug 25, 2023
1 parent 6cf5612 commit db385ff
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/PoolTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -388,4 +388,24 @@ public function it_can_be_stopped_early()
$this->assertGreaterThanOrEqual($stoppingPoint, $completedProcessesCount);
$this->assertLessThanOrEqual($concurrency * 2, $completedProcessesCount);
}

/** @test */
public function it_writes_large_serialized_tasks_to_file()
{
$pool = Pool::create()->maxTaskPayload(10);

$counter = 0;

foreach (range(1, 5) as $i) {
$pool->add(function () {
return 2;
})->then(function (int $output) use (&$counter) {
$counter += $output;
});
}

$pool->wait();

$this->assertEquals(10, $counter, (string) $pool->status());
}
}

0 comments on commit db385ff

Please sign in to comment.