public function createAlbum() { $client = $this->photos; $album = new Photos\AlbumEntry(); $album->setTitle($client->newTitle("testAlbum")); $album->setCategory(array($client->newCategory('http://schemas.google.com/photos/2007#album', 'http://schemas.google.com/g/2005#kind'))); $newAlbum = $client->insertAlbumEntry($album); $this->assertEquals($album->getTitle(), $newAlbum->getTitle()); $this->assertEquals($newAlbum->getTitle(), $client->getAlbumEntry($newAlbum->getLink('self')->href)->getTitle()); $albumFeedUri = $newAlbum->getLink('http://schemas.google.com/g/2005#feed')->href; $albumFeed = $client->getAlbumFeed($albumFeedUri); $this->verifyProperty($albumFeed, "title", "text", "testAlbum"); return $newAlbum; }
/** * Delete an AlbumEntry. * * @param \Zend\GData\Photos\AlbumEntry $album The album entry to * delete. * @param boolean $catch Whether to catch an exception when * modified and re-delete or throw * @return void. * @throws \Zend\GData\App\Exception * @throws \Zend\GData\App\HttpException */ public function deleteAlbumEntry($album, $catch) { if ($catch) { try { $this->delete($album); } catch (App\HttpException $e) { if ($e->getResponse()->getStatus() === 409) { $entry = new AlbumEntry($e->getResponse()->getBody()); $this->delete($entry->getLink('edit')->href); } else { throw $e; } } } else { $this->delete($album); } }