public function testApiStop_RejectsPromise_WhenInvokedFromStateCreatedOrDestroyed()
{
$runtime = $this->createModel();
$states = [Runtime::STATE_CREATED, Runtime::STATE_DESTROYED];
foreach ($states as $state) {
$runtime->setState($state);
$callable = $this->createCallableMock();
$callable->expects($this->once())->method('__invoke')->with($this->isInstanceOf(RejectionException::class));
$runtime->stop()->then($this->expectCallableNever(), $callable);
}
}