mirror of
https://github.com/danog/parallel.git
synced 2024-11-27 04:44:56 +01:00
24 lines
651 B
PHP
24 lines
651 B
PHP
<?php
|
|
|
|
namespace Amp\Parallel\Test\Worker;
|
|
|
|
use Amp\Parallel\Worker\DefaultPool;
|
|
use Amp\Parallel\Worker\Pool;
|
|
use Amp\Parallel\Worker\WorkerFactory;
|
|
use Amp\Parallel\Worker\WorkerThread;
|
|
|
|
/**
|
|
* @group threading
|
|
* @requires extension pthreads
|
|
*/
|
|
class ThreadPoolTest extends AbstractPoolTest {
|
|
protected function createPool($min = Pool::DEFAULT_MIN_SIZE, $max = Pool::DEFAULT_MAX_SIZE): Pool {
|
|
$factory = $this->createMock(WorkerFactory::class);
|
|
$factory->method('create')->will($this->returnCallback(function () {
|
|
return new WorkerThread;
|
|
}));
|
|
|
|
return new DefaultPool($min, $max, $factory);
|
|
}
|
|
}
|