2015-12-12 05:47:46 +01:00
|
|
|
<?php
|
|
|
|
namespace Icicle\Tests\Concurrent\Worker;
|
|
|
|
|
2016-01-23 07:00:56 +01:00
|
|
|
use Icicle\Concurrent\Worker\{DefaultPool, WorkerFactory, WorkerThread};
|
2015-12-12 05:47:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @group threading
|
|
|
|
* @requires extension pthreads
|
|
|
|
*/
|
|
|
|
class ThreadPoolTest extends AbstractPoolTest
|
|
|
|
{
|
2015-12-16 23:39:25 +01:00
|
|
|
protected function createPool($min = null, $max = null)
|
2015-12-12 05:47:46 +01:00
|
|
|
{
|
2015-12-12 06:28:44 +01:00
|
|
|
$factory = $this->getMock(WorkerFactory::class);
|
|
|
|
$factory->method('create')->will($this->returnCallback(function () {
|
|
|
|
return new WorkerThread();
|
|
|
|
}));
|
|
|
|
|
|
|
|
return new DefaultPool($min, $max, $factory);
|
2015-12-12 05:47:46 +01:00
|
|
|
}
|
|
|
|
}
|