/** * Creates a new RoleInstance from parsed response body. * * @param array $parsed The parsed response body in array representation. * * @return RoleInstance */ public static function create($parsed) { $roleInstance = new RoleInstance(); $roleName = Utilities::tryGetValue($parsed, Resources::XTAG_ROLE_NAME); $instanceName = Utilities::tryGetValue($parsed, Resources::XTAG_INSTANCE_NAME); $instanceStatus = Utilities::tryGetValue($parsed, Resources::XTAG_INSTANCE_STATUS); $instanceUpgradeDomain = Utilities::tryGetValue($parsed, Resources::XTAG_INSTANCE_UPGRADE_DOMAIN); $instanceFaultDomain = Utilities::tryGetValue($parsed, Resources::XTAG_INSTANCE_FAULT_DOMAIN); $instanceSize = Utilities::tryGetValue($parsed, Resources::XTAG_INSTANCE_SIZE); $instanceStateDetails = Utilities::tryGetValue($parsed, Resources::XTAG_INSTANCE_STATE_DETAILS); $instanceErrorCode = Utilities::tryGetValue($parsed, Resources::XTAG_INSTANCE_ERROR_CODE); $roleInstance->setInstanceErrorCode($instanceErrorCode); $roleInstance->setInstanceFaultDomain(intval($instanceFaultDomain)); $roleInstance->setInstanceName($instanceName); $roleInstance->setInstanceSize($instanceSize); $roleInstance->setInstanceStateDetails($instanceStateDetails); $roleInstance->setInstanceStatus($instanceStatus); $roleInstance->setInstanceUpgradeDomain(intval($instanceUpgradeDomain)); $roleInstance->setRoleName($roleName); return $roleInstance; }
/** * @covers WindowsAzure\ServiceManagement\Models\RoleInstance::setInstanceStateDetails * @covers WindowsAzure\ServiceManagement\Models\RoleInstance::getInstanceStateDetails */ public function testSetInstanceStateDetails() { // Setup $expected = 'instancestatedetails'; $roleInstance = new RoleInstance(); // Test $roleInstance->setInstanceStateDetails($expected); // Assert $this->assertEquals($expected, $roleInstance->getInstanceStateDetails()); }