/** * Returns the URL generated for this query, based on it's current * parameters. * * @return string A URL generated based on the state of this query. * @throws \Zend\GData\App\InvalidArgumentException */ public function getQueryUrl($incomingUri = '') { $uri = ''; if ($this->getAlbumName() !== null && $this->getAlbumId() === null) { $uri .= '/album/' . $this->getAlbumName(); } elseif ($this->getAlbumName() === null && $this->getAlbumId() !== null) { $uri .= '/albumid/' . $this->getAlbumId(); } elseif ($this->getAlbumName() !== null && $this->getAlbumId() !== null) { throw new App\InvalidArgumentException('AlbumName and AlbumId cannot both be non-null'); } else { throw new App\InvalidArgumentException('AlbumName and AlbumId cannot both be null'); } $uri .= $incomingUri; return parent::getQueryUrl($uri); }
/** * Check the consistency of a user feed request for private data */ public function testPrivateUserQuery() { $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user?access=private"; $query = new Photos\UserQuery(); $query->setUser("sample.user"); $query->setAccess("private"); $generatedString = $query->getQueryUrl(); // Assert that the generated query matches the correct one $this->assertEquals($queryString, $generatedString); }