/** * @covers WindowsAzure\ServiceManagement\Models\GetOperationStatusResult::create */ public function testCreateWithError() { // Setup $expected = new ServiceException('400', 'error message'); $input = array('Error' => array('Code' => '400', 'Message' => 'error message')); // Test $result = GetOperationStatusResult::create($input); // Assert $this->assertEquals($expected, $result->getError()); }
/** * Returns the status of the specified operation. After calling an asynchronous * operation, you can call Get Operation Status to determine whether the * operation has succeeded, failed, or is still in progress. * * @param string $requestId The request ID for the request you wish to track. * * @return Models\GetOperationStatusResult * * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee460783.aspx */ public function getOperationStatus($requestId) { $context = new HttpCallContext(); $context->setMethod(Resources::HTTP_GET); $context->setPath($this->_getOperationPath($requestId)); $context->addStatusCode(Resources::STATUS_OK); $response = $this->sendContext($context); $serialized = $this->dataSerializer->unserialize($response->getBody()); return GetOperationStatusResult::create($serialized); }