createMock(WorkerFactory::class); $factory->method('create')->will($this->returnCallback(function () { return new WorkerProcess; })); return new DefaultPool($min, $max, $factory); } }