public function testApiFlushThreads_RejectsPromise_WhenFlagIsDestroyKeep()
{
$flags = Runtime::DESTROY_KEEP;
$manager = $this->createThreadManager(['destroyThread']);
$manager->expects($this->never())->method('destroyThread');
$manager->allocateThread($alias1 = 'alias1', $object1 = new StdClass());
$manager->allocateThread($alias2 = 'alias2', $object2 = new StdClass());
$callable = $this->createCallableMock();
$callable->expects($this->once())->method('__invoke')->with($this->isInstanceOf(RejectionException::class));
$manager->flushThreads($flags)->then(null, $callable);
}