public function testResourceIsFormattingBaseUri() { $this->resource->setBaseUri(''); $this->assertEquals('http://example.com/api/', $this->resource->getBaseUri()); $this->resource->setBaseUri('http://test.COm'); $this->assertEquals('http://test.com/', $this->resource->getBaseUri()); }
/** * @param ClassMetadata $metaData * @param $entity * * @return ResourceInterface|Resource * @throws Exception */ protected function createResource(ClassMetadata $metaData, $entity) : Resource { $resource = new Resource(); if (!empty($this->getBaseUri())) { $resource->setBaseUri($this->getBaseUri() . strtolower($resource->getName()) . '/'); } $resource->setClass(get_class($entity)); $resource->setName(strtolower(str_replace($metaData->namespace . '\\', '', $metaData->name))); $resource->setProperties($this->getEntityColumnValues($entity, $metaData)); $resource->setRelations($this->getEmbeddedRelations($entity, $metaData)); return $resource; }