public function createThreadManager($methods = [])
{
$runtime = $this->getMock(RuntimeContainerInterface::class, [], [], '', false);
$channel = $this->getMock(ChannelInterface::class, [], [], '', false);
$methods = array_merge($methods, ['createRequest']);
$manager = $this->getMock(ThreadManagerBase::class, $methods, [$runtime, $channel, []]);
$manager->expects($this->any())->method('createRequest')->will($this->returnCallback(function ($channel, $receiver, $command) {
$this->command = $command;
$mock = $this->getMock(RuntimeCommand::class, ['call'], [$channel, $receiver, $command]);
$mock->expects($this->once())->method('call')->will($this->returnValue(new PromiseFulfilled()));
return $mock;
}));
return $manager;
}