/** * @dataProvider getMetadataUrls */ public function testCanFetchTheUserAndTheImageIdentifierInTheUrl($url, $user, $imageIdentifier) { $imageUrl = MetadataUrl::factory($url); $this->assertSame($user, $imageUrl->getUser(), 'Could not correctly identify the user in the URL'); $this->assertSame($imageIdentifier, $imageUrl->getImageIdentifier(), 'Could not correctly identify the image identifier in the URL'); }
/** * Get a URL for the metadata resource * * @param string $imageIdentifier An image identifier * @return Http\MetadataUrl */ public function getMetadataUrl($imageIdentifier) { $url = sprintf($this->getHostForImageIdentifier($imageIdentifier) . '/users/%s/images/%s/metadata.json', $this->getUser(), $imageIdentifier); return Http\MetadataUrl::factory($url, $this->getConfig('privateKey'), $this->getPublicKey()); }