/** * 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]); }
/** * get all endpoints for an API * * @param boolean $withHost attach host name to the url * @param bool $forceReload Switch to force a new api definition object will be provided. * * @return array */ public function getAllEndpoints($withHost = false, $forceReload = false) { $this->loadApiDefinition($forceReload); $host = empty($this->options['host']) ? '' : $this->options['host']; $prefix = self::PROXY_ROUTE; if (isset($this->options['prefix'])) { $prefix .= "/" . $this->options['prefix']; } $retVal = array(); if (is_object($this->definition)) { $retVal = $this->definition->getEndpoints($withHost, $prefix, $host); } return $retVal; }