/** * Translates the current instance info. * * @param string $environmentInfo The environment info. * * @return RoleInstance */ private function _translateCurrentInstance($environmentInfo) { $endpoints = array(); $endpointsInfo = Utilities::tryGetKeysChainValue($environmentInfo, 'CurrentInstance', 'Endpoints', 'Endpoint'); if (!is_null($endpointsInfo)) { $endpoints = $this->_translateRoleInstanceEndpoints($endpointsInfo); } $currentInstance = new RoleInstance($environmentInfo['CurrentInstance']['@attributes']['id'], $environmentInfo['CurrentInstance']['@attributes']['faultDomain'], $environmentInfo['CurrentInstance']['@attributes']['updateDomain'], $endpoints); foreach ($currentInstance->getInstanceEndpoints() as $endpoint) { $endpoint->setRoleInstance($currentInstance); } return $currentInstance; }
/** * @covers WindowsAzure\ServiceRuntime\Internal\RoleInstance::getRole * @covers WindowsAzure\ServiceRuntime\Internal\RoleInstance::setRole */ public function testGetSetRole() { $role = new Role(null, array()); // Setup $roleInstance = new RoleInstance(null, null, null, null); // Test $roleInstance->setRole($role); $this->assertEquals($role, $roleInstance->getRole()); }