/** * test endpoint definition with a configured host * * @return void */ public function testGetEndPointsWithDefinedHost() { $endpoint = "/this/is/an/endpoint"; $host = "blabla.talk:8080"; $preferedHost = "someHost.talk:8000"; $sut = new ApiDefinition(); $sut->addEndpoint($endpoint); $sut->setHost($host); $this->assertEquals($preferedHost . $endpoint, $sut->getEndpoints(true, null, $preferedHost)[0]); }
/** * Sets the destination host for the api definition. * * @param ApiDefinition $apiDef Configuration for the swagger api to be recognized. * * @return void */ private function registerHost(ApiDefinition $apiDef) { try { $host = $this->document->getHost(); } catch (MissingDocumentPropertyException $e) { $host = $this->fallbackData['host']; } $apiDef->setHost($host); }