2016-12-30 02:16:04 +01:00
|
|
|
<?php
|
2015-12-16 18:16:21 +01:00
|
|
|
|
2016-08-23 23:47:40 +02:00
|
|
|
namespace Amp\Parallel\Test\Worker;
|
2016-08-18 18:04:48 +02:00
|
|
|
|
2017-05-18 09:51:31 +02:00
|
|
|
use Amp\Parallel\Worker\DefaultPool;
|
2017-12-13 04:39:51 +01:00
|
|
|
use Amp\Parallel\Worker\Pool;
|
2017-05-18 09:51:31 +02:00
|
|
|
use Amp\Parallel\Worker\WorkerFactory;
|
|
|
|
use Amp\Parallel\Worker\WorkerProcess;
|
2015-12-16 18:16:21 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @group process
|
|
|
|
*/
|
2018-10-07 16:50:45 +02:00
|
|
|
class ProcessPoolTest extends AbstractPoolTest
|
|
|
|
{
|
|
|
|
protected function createPool($max = Pool::DEFAULT_MAX_SIZE): Pool
|
|
|
|
{
|
2016-08-19 00:36:58 +02:00
|
|
|
$factory = $this->createMock(WorkerFactory::class);
|
2015-12-16 18:16:21 +01:00
|
|
|
$factory->method('create')->will($this->returnCallback(function () {
|
2016-08-23 01:25:19 +02:00
|
|
|
return new WorkerProcess;
|
2015-12-16 18:16:21 +01:00
|
|
|
}));
|
|
|
|
|
2017-12-13 21:14:31 +01:00
|
|
|
return new DefaultPool($max, $factory);
|
2015-12-16 18:16:21 +01:00
|
|
|
}
|
|
|
|
}
|