Kraken\_Unit\Runtime\RuntimeModelTest::testApiFail_HandlesErrorThrownByItself PHP Method

testApiFail_HandlesErrorThrownByItself() public method

    public function testApiFail_HandlesErrorThrownByItself()
    {
        $ex1 = new Exception();
        $ex2 = new RejectionException();
        $params = ['param' => 'value'];
        $super = $this->getMock(Supervisor::class, [], [], '', false);
        $super->expects($this->twice())->method('solve')->will($this->returnValue(new PromiseRejected($ex2)));
        $loop = $this->getMock(Loop::class, [], [], '', false);
        $loop->expects($this->once())->method('onTick')->will($this->returnCallback(function ($callable) {
            $callable();
        }));
        $runtime = $this->createModel([], ['getSupervisor', 'getLoop', 'setLoopState']);
        $runtime->expects($this->once())->method('getSupervisor')->will($this->returnValue($super));
        $runtime->expects($this->once())->method('getLoop')->will($this->returnValue($loop));
        $runtime->expects($this->once())->method('setLoopState')->with(RuntimeModel::LOOP_STATE_FAILED);
        $runtime->fail($ex1, $params);
    }
RuntimeModelTest