public function testWaitForStateTimeOut()
 {
     $Facker = Factory::create();
     $MockedModel = new Model(json_decode(ServiceTest::getMockData(), true));
     $this->mockResponses([new Response(200, ['Content-Type' => 'application/json'], Encoder::encode($MockedModel->setState(Model::STATE_NOT_RUNNING)->getArrayCopy())), new Response(200, ['Content-Type' => 'application/json'], Encoder::encode($MockedModel->setState(Model::STATE_STARTING)->getArrayCopy()))]);
     $API = new API();
     $Model = $API->get($Facker->uuid);
     $this->expectException(Exception::class);
     $this->expectExceptionMessageRegExp('/.*timed out.*/');
     $API->waitForState($Model, Model::STATE_RUNNING, 0.1, 0);
 }
예제 #2
0
 /**
  * @return string
  */
 protected function getMockData()
 {
     return APITest::getMockData();
 }
예제 #3
0
 /**
  * @return string
  */
 protected function getMockData()
 {
     $data = (new Service(json_decode(APITest::getMockData())))->getLinkedToService();
     return \Zend\Json\Encoder::encode(array_pop($data));
 }
예제 #4
0
 /**
  * @param Model $Model
  *
  * @depends testCreate
  */
 public function testUpdate(Model $Model)
 {
     $this->mockResponse(200, $this->getMockData());
     $API = new API();
     $Model->setServices([ServiceTest::getMockData()]);
     $Model = $API->update($Model);
     $this->assertInstanceOf(Model::class, $Model);
 }