/** * @covers Mozu\Api\Resources\Platform\TenantResource::getTenant * @todo Implement testGetTenant(). */ public function testGetTenant() { try { $tenant = $this->object->getTenant($this->tenantId); $this->assertSame($tenant->id, $this->tenantId); } catch (Exception $e) { parent::printError($e); $this->fail($e->getMessage()); } }
private function validateContext() { if ($this->mozuUrl->getLocation() == UrlLocation::TENANT_POD) { if ($this->apiContext->getTenantId() < 0) { throw new \Exception("TenantId is missing"); } if (trim($this->apiContext->getTenantUrl()) == "") { $tenantResource = new TenantResource(new ApiContext()); $tenant = $tenantResource->getTenant($this->apiContext->getTenantId()); if ($tenant == null) { throw new \Exception("Tenant " . $this->apiContext->getTenantId() . " Not found"); } $this->baseAddress = HttpHelper::getUrl($tenant->domain); } else { $this->baseAddress = HttpHelper::getUrl($this->apiContext->getTenantUrl()); } } else { if ($this->mozuUrl->getLocation() == UrlLocation::PCI_POD) { if ($this->apiContext->getTenantId() < 0) { throw new \Exception("TenantId is missing"); } if (!isset(MozuConfig::$basePciUrl)) { throw new \Exception("MozuConfig basePciUrl is empty. A valid value is required"); } $this->baseAddress = MozuConfig::$basePciUrl; } else { $authentication = AppAuthenticator::getInstance(); if ($authentication == null) { throw new \Exception("App is not initialized. Use AppAuthenticator to initialize the app."); } if (!isset(MozuConfig::$baseAppAuthUrl)) { throw new \Exception("MozuConfig baseAppAuthUrl is empty. A valid value is required"); } $this->baseAddress = MozuConfig::$baseAppAuthUrl; } } }