Kraken\_Unit\Runtime\RuntimeModelTest::testApiDestroy_CallsStopAndRejectsPromise_WhenInvokedFromStateOtherThanDestroyedAndStopFailed PHP Метод

testApiDestroy_CallsStopAndRejectsPromise_WhenInvokedFromStateOtherThanDestroyedAndStopFailed() публичный Метод

    public function testApiDestroy_CallsStopAndRejectsPromise_WhenInvokedFromStateOtherThanDestroyedAndStopFailed()
    {
        $states = [Runtime::STATE_CREATED, Runtime::STATE_STARTED, Runtime::STATE_STOPPED];
        foreach ($states as $state) {
            $runtime = $this->createModel([], ['stop']);
            $runtime->expects($this->once())->method('stop')->will($this->returnValue(new PromiseRejected($ex = new RejectionException())));
            $runtime->setState($state);
            $callable = $this->createCallableMock();
            $callable->expects($this->once())->method('__invoke')->with($this->isInstanceOf(RejectionException::class));
            $runtime->destroy()->then($this->expectCallableNever(), $callable);
        }
    }
RuntimeModelTest