/**
  * @covers WindowsAzure\ServiceManagement\Models\DeploymentStatus::isValid
  */
 public function testIsValidWithInvalid()
 {
     // Setup
     $expected = false;
     // Test
     $actual = DeploymentStatus::isValid('Wrong value');
     // Assert
     $this->assertEquals($expected, $actual);
 }
Ejemplo n.º 2
0
 /**
  * Initiates a change in deployment status.
  *
  * Note that you can change deployment status either by specifying the deployment
  * environment (staging or production), or by specifying the deployment's unique
  * name.
  *
  * @param string               $name    The hosted service name.
  * @param string               $status  The change to initiate to the
  * deployment status.
  * Possible values include Running or Suspended.
  * @param GetDeploymentOptions $options The optional parameters.
  *
  * @return AsynchronousOperationResult
  *
  * @see http://msdn.microsoft.com/en-us/library/windowsazure/ee460808.aspx
  */
 public function updateDeploymentStatus($name, $status, $options)
 {
     Validate::isString($name, 'name');
     Validate::notNullOrEmpty($name, 'name');
     Validate::isTrue(DeploymentStatus::isValid($status), Resources::INVALID_DEPLOYMENT_STATUS_MSG);
     Validate::notNullOrEmpty($options, 'options');
     $body = $this->_createRequestXml(array(Resources::XTAG_STATUS => $status), Resources::XTAG_UPDATE_DEPLOYMENT_STATUS);
     $context = new HttpCallContext();
     $context->setMethod(Resources::HTTP_POST);
     $context->setPath($this->_getDeploymentPath($name, $options) . '/');
     $context->addStatusCode(Resources::STATUS_ACCEPTED);
     $context->addQueryParameter(Resources::QP_COMP, Resources::QPV_STATUS);
     $context->setBody($body);
     $context->addHeader(Resources::CONTENT_TYPE, Resources::XML_CONTENT_TYPE);
     assert(Utilities::endsWith($context->getPath(), '/'));
     $response = $this->sendContext($context);
     return AsynchronousOperationResult::create($response->getHeader());
 }