diff options
| author | Horus3 | 2014-02-24 16:42:14 +0100 |
|---|---|---|
| committer | Horus3 | 2014-02-24 16:42:14 +0100 |
| commit | 06f945f27840b53e57795dadbc38e76f7e11ab1c (patch) | |
| tree | 689d5c7f4ffa15460c7e90f47c6a7dd59ce4e8bd /zend/tests/Zend/Gdata/Photos | |
| download | random-06f945f27840b53e57795dadbc38e76f7e11ab1c.tar.gz | |
init
Diffstat (limited to 'zend/tests/Zend/Gdata/Photos')
20 files changed, 3578 insertions, 0 deletions
diff --git a/zend/tests/Zend/Gdata/Photos/PhotosAlbumEntryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosAlbumEntryTest.php new file mode 100755 index 0000000..3e3cc6e --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosAlbumEntryTest.php @@ -0,0 +1,364 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/AlbumEntry.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosAlbumEntryTest extends PHPUnit_Framework_TestCase +{ + + protected $albumEntry = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $albumEntryText = file_get_contents( + '_files/TestAlbumEntry.xml', + true); + $this->albumEntry = new Zend_Gdata_Photos_AlbumEntry($albumEntryText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Verify that a given property is set to a specific value, + * that it keeps that value when set using the setter, + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty3($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $propSetter = "set" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + $secondSetter = "set" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $obj->$propSetter($obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Check for the existence of an <atom:author> and verify that they + * contain the expected values. + */ + public function testAuthor() + { + $entry = $this->albumEntry; + + // Assert that the entry's author is correct + $entryAuthor = $entry->getAuthor(); + $this->assertEquals($entryAuthor, $entry->author); + $this->assertEquals(1, count($entryAuthor)); + $this->assertTrue($entryAuthor[0] instanceof Zend_Gdata_App_Extension_Author); + $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); + $this->assertTrue($entryAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); + $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $entry = $this->albumEntry; + + // Assert that the entry's ID is correct + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1"); + } + + /** + * Check for the existence of an <atom:published> and verify that it contains + * the expected value. + */ + public function testPublished() + { + $entry = $this->albumEntry; + + // Assert that the photo entry has an Atom Published object + $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); + $this->verifyProperty2($entry, "published", "text", "2007-09-05T07:00:00.000Z"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $entry = $this->albumEntry; + + // Assert that the entry's updated date is correct + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($entry, "updated", "text", + "2007-09-05T20:49:24.000Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($entry, "title", "text", "Test"); + } + + /** + * Check for the existence of an <gphoto:user> and verify that it contains + * the expected value. + */ + public function testGphotoUser() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); + $this->verifyProperty2($entry, "gphotoUser", "text", + "sample.user"); + $this->verifyProperty3($entry, "gphotoUser", "text", + "sample.user"); + } + + /** + * Check for the existence of an <gphoto:nickname> and verify that it contains + * the expected value. + */ + public function testGphotoNickname() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); + $this->verifyProperty2($entry, "gphotoNickname", "text", + "sample"); + $this->verifyProperty3($entry, "gphotoNickname", "text", + "sample"); + } + + /** + * Check for the existence of an <gphoto:name> and verify that it contains + * the expected value. + */ + public function testGphotoName() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoName() instanceof Zend_Gdata_Photos_Extension_Name); + $this->verifyProperty2($entry, "gphotoName", "text", + "Test"); + $this->verifyProperty3($entry, "gphotoName", "text", + "Test"); + } + + /** + * Check for the existence of an <gphoto:id> and verify that it contains + * the expected value. + */ + public function testGphotoId() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); + $this->verifyProperty2($entry, "gphotoId", "text", + "1"); + $this->verifyProperty3($entry, "gphotoId", "text", + "1"); + } + + /** + * Check for the existence of an <gphoto:location> and verify that it contains + * the expected value. + */ + public function testGphotoLocation() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoLocation() instanceof Zend_Gdata_Photos_Extension_Location); + $this->verifyProperty2($entry, "gphotoLocation", "text", + ""); + } + + /** + * Check for the existence of an <gphoto:access> and verify that it contains + * the expected value. + */ + public function testGphotoAccess() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoAccess() instanceof Zend_Gdata_Photos_Extension_Access); + $this->verifyProperty2($entry, "gphotoAccess", "text", + "public"); + $this->verifyProperty3($entry, "gphotoAccess", "text", + "public"); + } + + /** + * Check for the existence of an <gphoto:timestamp> and verify that it contains + * the expected value. + */ + public function testGphotoTimestamp() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); + $this->verifyProperty2($entry, "gphotoTimestamp", "text", + "1188975600000"); + $this->verifyProperty3($entry, "gphotoTimestamp", "text", + "1188975600000"); + } + + /** + * Check for the existence of an <gphoto:numphotos> and verify that it contains + * the expected value. + */ + public function testGphotoNumPhotos() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoNumPhotos() instanceof Zend_Gdata_Photos_Extension_NumPhotos); + $this->verifyProperty2($entry, "gphotoNumPhotos", "text", + "2"); + $this->verifyProperty3($entry, "gphotoNumPhotos", "text", + "2"); + } + + /** + * Check for the existence of an <gphoto:commentingEnabled> and verify that it contains + * the expected value. + */ + public function testGphotoCommentingEnabled() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); + $this->verifyProperty2($entry, "gphotoCommentingEnabled", "text", + "true"); + $this->verifyProperty3($entry, "gphotoCommentingEnabled", "text", + "true"); + } + + /** + * Check for the existence of an <gphoto:commentCount> and verify that it contains + * the expected value. + */ + public function testGphotoCommentCount() + { + $entry = $this->albumEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); + $this->verifyProperty2($entry, "gphotoCommentCount", "text", + "0"); + $this->verifyProperty3($entry, "gphotoCommentCount", "text", + "0"); + } + + /** + * Check for the existence of a <media:group> + */ + public function testMediaGroup() + { + $entry = $this->albumEntry; + + // Assert that the entry's media group exists + $this->assertTrue($entry->getMediaGroup() instanceof Zend_Gdata_Media_Extension_MediaGroup); + } + + /** + * Check for the geo data and verify that it contains the expected values + */ + public function testGeoData() + { + $geoRssWhere = $this->albumEntry->geoRssWhere; + $point = $geoRssWhere->point; + $pos = $point->pos; + $this->assertEquals("42.87194 13.56738", $pos->text); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosAlbumFeedTest.php b/zend/tests/Zend/Gdata/Photos/PhotosAlbumFeedTest.php new file mode 100755 index 0000000..0dcd759 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosAlbumFeedTest.php @@ -0,0 +1,469 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/AlbumFeed.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosAlbumFeedTest extends PHPUnit_Framework_TestCase +{ + + protected $albumFeed = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $albumFeedText = file_get_contents( + '_files/TestAlbumFeed.xml', + true); + $this->albumFeed = new Zend_Gdata_Photos_AlbumFeed($albumFeedText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Verify that a given property is set to a specific value, + * that it keeps that value when set using the setter, + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty3($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $propSetter = "set" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + $secondSetter = "set" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $obj->$propSetter($obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Convert sample feed to XML then back to objects. Ensure that + * all objects are instances of appropriate entry type and object count matches. + */ + public function testAlbumFeedToAndFromString() + { + $entryCount = 0; + foreach ($this->albumFeed as $entry) { + $entryCount++; + $this->assertTrue($entry instanceof Zend_Gdata_Photos_PhotoEntry || + $entry instanceof Zend_Gdata_Photos_TagEntry); + } + $this->assertTrue($entryCount > 0); + + /* Grab XML from $this->albumFeed and convert back to objects */ + $newListFeed = new Zend_Gdata_Photos_UserFeed( + $this->albumFeed->saveXML()); + $newEntryCount = 0; + foreach ($newListFeed as $entry) { + $newEntryCount++; + $this->assertTrue($entry instanceof Zend_Gdata_Photos_PhotoEntry || + $entry instanceof Zend_Gdata_Photos_TagEntry); + } + $this->assertEquals($entryCount, $newEntryCount); + } + + /** + * Ensure that the number of entries equals the number + * of entries defined in the sample file. + */ + public function testEntryCount() + { + $entryCount = 0; + foreach ($this->albumFeed as $entry) { + $entryCount++; + } + $this->assertEquals(4, $entryCount); + } + + /** + * Check for the existence of an <atom:author> and verify that they + * contain the expected values. + */ + public function testAuthor() + { + $feed = $this->albumFeed; + + // Assert that the feed's author is correct + $feedAuthor = $feed->getAuthor(); + $this->assertEquals($feedAuthor, $feed->author); + $this->assertEquals(1, count($feedAuthor)); + $this->assertTrue($feedAuthor[0] instanceof Zend_Gdata_App_Extension_Author); + $this->verifyProperty2($feedAuthor[0], "name", "text", "sample"); + $this->assertTrue($feedAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); + $this->verifyProperty2($feedAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); + + // Assert that each entry has valid author data + foreach ($feed as $entry) { + if ($entry instanceof Zend_Gdata_Photos_AlbumEntry) { + $entryAuthor = $entry->getAuthor(); + $this->assertEquals(1, count($entryAuthor)); + $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); + $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); + } + } + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $feed = $this->albumFeed; + + // Assert that the feed's ID is correct + $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($feed, "id", "text", + "http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1"); + + // Assert that all entries have an Atom ID object + foreach ($feed as $entry) { + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + } + + // Assert one of the entry's IDs + $entry = $feed[0]; + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/2"); + } + + /** + * Check for the existence of an <atom:published> and verify that it contains + * the expected value. + */ + public function testPublished() + { + $feed = $this->albumFeed; + + // Assert that all photo entries have an Atom Published object + foreach ($feed as $entry) { + if ($entry instanceof Zend_Gdata_Photos_PhotoEntry) { + $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); + } + } + + // Assert one of the entry's Published dates + $entry = $feed[0]; + $this->verifyProperty2($entry, "published", "text", "2007-09-05T20:49:23.000Z"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $feed = $this->albumFeed; + + // Assert that the feed's updated date is correct + $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($feed, "updated", "text", + "2007-09-21T18:23:05.000Z"); + + // Assert that all entries have an Atom Updated object + foreach ($feed as $entry) { + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + } + + // Assert one of the entry's Updated dates + $entry = $feed[0]; + $this->verifyProperty2($entry, "updated", "text", "2007-09-21T18:23:05.000Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($feed, "title", "text", "Test"); + + // Assert that all entries have an Atom ID object + foreach ($feed as $entry) { + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + } + + // Assert one of the entry's Titles + $entry = $feed[0]; + $this->verifyProperty2($entry, "title", "text", "Aqua Blue.jpg"); + } + + /** + * Check for the existence of an <atom:subtitle> and verify that it contains + * the expected value. + */ + public function testSubtitle() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); + $this->verifyProperty2($feed, "subtitle", "text", + ""); + } + + /** + * Check for the existence of an <atom:generator> and verify that it contains + * the expected value. + */ + public function testGenerator() + { + $feed = $this->albumFeed; + + // Assert that the feed's generator is correct + $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); + $this->verifyProperty2($feed, "generator", "version", "1.00"); + $this->verifyProperty2($feed, "generator", "uri", "http://picasaweb.google.com/"); + $this->verifyProperty2($feed, "generator", "text", "Picasaweb"); + } + + /** + * Check for the existence of an <atom:icon> and verify that it contains + * the expected value. + */ + public function testIcon() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getIcon() instanceof Zend_Gdata_App_Extension_Icon); + $this->verifyProperty2($feed, "icon", "text", + "http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/s160-c/Test.jpg"); + } + + /** + * Check for the existence of an <gphoto:user> and verify that it contains + * the expected value. + */ + public function testGphotoUser() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); + $this->verifyProperty2($feed, "gphotoUser", "text", + "sample.user"); + $this->verifyProperty3($feed, "gphotoUser", "text", + "sample.user"); + } + + /** + * Check for the existence of an <gphoto:nickname> and verify that it contains + * the expected value. + */ + public function testGphotoNickname() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); + $this->verifyProperty2($feed, "gphotoNickname", "text", + "sample"); + $this->verifyProperty3($feed, "gphotoNickname", "text", + "sample"); + } + + /** + * Check for the existence of an <gphoto:name> and verify that it contains + * the expected value. + */ + public function testGphotoName() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoName() instanceof Zend_Gdata_Photos_Extension_Name); + $this->verifyProperty2($feed, "gphotoName", "text", + "Test"); + } + + /** + * Check for the existence of an <gphoto:id> and verify that it contains + * the expected value. + */ + public function testGphotoId() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); + $this->verifyProperty2($feed, "gphotoId", "text", + "1"); + $this->verifyProperty3($feed, "gphotoId", "text", + "1"); + } + + /** + * Check for the existence of an <gphoto:location> and verify that it contains + * the expected value. + */ + public function testGphotoLocation() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoLocation() instanceof Zend_Gdata_Photos_Extension_Location); + $this->verifyProperty2($feed, "gphotoLocation", "text", + ""); + $this->verifyProperty3($feed, "gphotoLocation", "text", + ""); + } + + /** + * Check for the existence of an <gphoto:access> and verify that it contains + * the expected value. + */ + public function testGphotoAccess() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoAccess() instanceof Zend_Gdata_Photos_Extension_Access); + $this->verifyProperty2($feed, "gphotoAccess", "text", + "public"); + $this->verifyProperty3($feed, "gphotoAccess", "text", + "public"); + } + + /** + * Check for the existence of an <gphoto:timestamp> and verify that it contains + * the expected value. + */ + public function testGphotoTimestamp() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); + $this->verifyProperty2($feed, "gphotoTimestamp", "text", + "1188975600000"); + $this->verifyProperty3($feed, "gphotoTimestamp", "text", + "1188975600000"); + } + + /** + * Check for the existence of an <gphoto:numphotos> and verify that it contains + * the expected value. + */ + public function testGphotoNumPhotos() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoNumPhotos() instanceof Zend_Gdata_Photos_Extension_NumPhotos); + $this->verifyProperty2($feed, "gphotoNumPhotos", "text", + "2"); + $this->verifyProperty3($feed, "gphotoNumPhotos", "text", + "2"); + } + + /** + * Check for the existence of an <gphoto:commentingEnabled> and verify that it contains + * the expected value. + */ + public function testGphotoCommentingEnabled() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); + $this->verifyProperty2($feed, "gphotoCommentingEnabled", "text", + "true"); + $this->verifyProperty3($feed, "gphotoCommentingEnabled", "text", + "true"); + } + + /** + * Check for the existence of an <gphoto:commentCount> and verify that it contains + * the expected value. + */ + public function testGphotoCommentCount() + { + $feed = $this->albumFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); + $this->verifyProperty2($feed, "gphotoCommentCount", "text", + "0"); + $this->verifyProperty3($feed, "gphotoCommentCount", "text", + "0"); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosAlbumQueryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosAlbumQueryTest.php new file mode 100755 index 0000000..7035535 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosAlbumQueryTest.php @@ -0,0 +1,198 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/AlbumQuery.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosAlbumQueryTest extends PHPUnit_Framework_TestCase +{ + + /** + * Check the consistency of an album feed request + */ + public function testSimpleAlbumQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1"; + + $query = new Zend_Gdata_Photos_AlbumQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/album/test"; + + $query->setAlbumId(null); + $query->setAlbumName("test"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check for thrown exceptions upon improper albumname/id setting + */ + public function testAlbumQueryExceptions() + { + $query = new Zend_Gdata_Photos_AlbumQuery(); + $query->setUser("sample.user"); + + try { + $generatedString = $query->getQueryUrl(); + } catch (Exception $e) { + $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); + } + + $query->setAlbumId("1"); + $query->setAlbumName("test"); + + try { + $generatedString = $query->getQueryUrl(); + } catch (Exception $e) { + $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); + } + } + + /** + * Check the consistency of an album feed request + * Projection is set to base + */ + public function testBaseAlbumQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/base/user/sample.user/albumid/1"; + + $query = new Zend_Gdata_Photos_AlbumQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setProjection("base"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check the consistency of an album feed request filtered + * for a specific tag + */ + public function testTagFilterAlbumQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?tag=test"; + + $query = new Zend_Gdata_Photos_AlbumQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setTag("test"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check the consistency of an album feed request for private data + */ + public function testPrivateAlbumQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?access=private"; + + $query = new Zend_Gdata_Photos_AlbumQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setAccess("private"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check the consistency of an album feed request for specifically-sized thumbnails + */ + public function testThumbnailAlbumQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?thumbsize=72"; + + $query = new Zend_Gdata_Photos_AlbumQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setThumbsize("72"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the set thumbsize is correct + $this->assertEquals("72", $query->getThumbsize()); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check the consistency of an album feed request for specifically-sized images + */ + public function testImgAlbumQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?imgmax=800"; + + $query = new Zend_Gdata_Photos_AlbumQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setImgMax("800"); + + // Assert that the set ImgMax is correct + $this->assertEquals("800", $query->getImgMax()); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + + // Check that ImgMax is set back to null + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1"; + $query->setImgMax(null); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosCommentEntryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosCommentEntryTest.php new file mode 100755 index 0000000..b2f1a08 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosCommentEntryTest.php @@ -0,0 +1,229 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/CommentEntry.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosCommentEntryTest extends PHPUnit_Framework_TestCase +{ + + protected $commentEntry = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $commentEntryText = file_get_contents( + '_files/TestCommentEntry.xml', + true); + $this->commentEntry = new Zend_Gdata_Photos_CommentEntry($commentEntryText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Verify that a given property is set to a specific value, + * that it keeps that value when set using the setter, + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty3($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $propSetter = "set" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + $secondSetter = "set" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $obj->$propSetter($obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $entry = $this->commentEntry; + + // Assert that the entry's ID is correct + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5"); + } + + /** + * Check for the existence of an <atom:author> and verify that they + * contain the expected values. + */ + public function testAuthor() + { + $entry = $this->commentEntry; + + // Assert that the entry's author is correct + $entryAuthor = $entry->getAuthor(); + $this->assertEquals($entryAuthor, $entry->author); + $this->assertEquals(1, count($entryAuthor)); + $this->assertTrue($entryAuthor[0] instanceof Zend_Gdata_App_Extension_Author); + $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); + $this->assertTrue($entryAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); + $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); + } + + /** + * Check for the existence of an <atom:published> and verify that it contains + * the expected value. + */ + public function testPublished() + { + $entry = $this->commentEntry; + + // Assert that the photo entry has an Atom Published object + $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); + $this->verifyProperty2($entry, "published", "text", "2007-09-21T18:22:53.000Z"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $entry = $this->commentEntry; + + // Assert that the entry's updated date is correct + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($entry, "updated", "text", + "2007-09-21T18:22:53.000Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $entry = $this->commentEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($entry, "title", "text", "sample"); + } + + /** + * Check for the existence of an <atom:content> and verify that it contains + * the expected value. + */ + public function testContent() + { + $entry = $this->commentEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getContent() instanceof Zend_Gdata_App_Extension_Content); + $this->verifyProperty2($entry, "content", "text", "test comment"); + } + + /** + * Check for the existence of an <gphoto:id> and verify that it contains + * the expected value. + */ + public function testGphotoId() + { + $entry = $this->commentEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); + $this->verifyProperty2($entry, "gphotoId", "text", + "5"); + $this->verifyProperty3($entry, "gphotoId", "text", + "5"); + } + + /** + * Check for the existence of an <gphoto:photoid> and verify that it contains + * the expected value. + */ + public function testGphotoPhotoId() + { + $entry = $this->commentEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoPhotoId() instanceof Zend_Gdata_Photos_Extension_PhotoId); + $this->verifyProperty2($entry, "gphotoPhotoId", "text", + "100"); + $this->verifyProperty3($entry, "gphotoPhotoId", "text", + "100"); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosPhotoEntryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosPhotoEntryTest.php new file mode 100755 index 0000000..1684454 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosPhotoEntryTest.php @@ -0,0 +1,395 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/PhotoEntry.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosPhotoEntryTest extends PHPUnit_Framework_TestCase +{ + + protected $photoEntry = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $photoEntryText = file_get_contents( + '_files/TestPhotoEntry.xml', + true); + $this->photoEntry = new Zend_Gdata_Photos_PhotoEntry($photoEntryText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Verify that a given property is set to a specific value, + * that it keeps that value when set using the setter, + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty3($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $propSetter = "set" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + $secondSetter = "set" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $obj->$propSetter($obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $entry = $this->photoEntry; + + // Assert that the entry's ID is correct + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100"); + } + + /** + * Check for the existence of an <atom:published> and verify that it contains + * the expected value. + */ + public function testPublished() + { + $entry = $this->photoEntry; + + // Assert that the photo entry has an Atom Published object + $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); + $this->verifyProperty2($entry, "published", "text", "2007-09-05T20:49:24.000Z"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $entry = $this->photoEntry; + + // Assert that the entry's updated date is correct + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($entry, "updated", "text", + "2007-09-21T18:19:38.000Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $entry = $this->photoEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($entry, "title", "text", "Aqua Graphite.jpg"); + } + + /** + * Check for the existence of an <gphoto:id> and verify that it contains + * the expected value. + */ + public function testGphotoId() + { + $entry = $this->photoEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); + $this->verifyProperty2($entry, "gphotoId", "text", + "100"); + $this->verifyProperty3($entry, "gphotoId", "text", + "100"); + } + + /** + * Check for the existance of exif namespaced data and verify that it contains + * the expected value. + */ + public function testExifData() + { + $exifTags = $this->photoEntry->exifTags; + $this->assertTrue($exifTags != null); + $this->assertTrue($exifTags->flash != null); + $this->assertTrue($exifTags->fstop != null); + $this->assertTrue($exifTags->exposure != null); + $this->assertTrue($exifTags->focallength != null); + $this->assertTrue($exifTags->iso != null); + $this->assertTrue($exifTags->time != null); + $this->assertTrue($exifTags->distance != null); + $this->assertTrue($exifTags->make != null); + $this->assertTrue($exifTags->model != null); + $this->assertTrue($exifTags->imageUniqueID != null); + $this->assertEquals("true", $exifTags->flash->text); + $this->assertEquals("11.0", $exifTags->fstop->text); + $this->assertEquals("0.0040", $exifTags->exposure->text); + $this->assertEquals("22.0", $exifTags->focallength->text); + $this->assertEquals("200", $exifTags->iso->text); + $this->assertEquals("1180950900000", $exifTags->time->text); + $this->assertEquals("0.0",$exifTags->distance->text); + $this->assertEquals("Fictitious Camera Company",$exifTags->make->text); + $this->assertEquals("AMAZING-100D",$exifTags->model->text); + $this->assertEquals("a5ce2e36b9df7d3cb081511c72e73926", $exifTags->imageUniqueID->text); + } + + /** + * Check for the geo data and verify that it contains the expected values + */ + public function testGeoData() + { + $geoRssWhere = $this->photoEntry->geoRssWhere; + $point = $geoRssWhere->point; + $pos = $point->pos; + $this->assertEquals("41.87194 12.56738", $pos->text); + } + + + /** + * Check for the existence of an <gphoto:version> and verify that it contains + * the expected value. + */ + public function testGphotoVersion() + { + $entry = $this->photoEntry; + + // Assert that the entry's version is correct + $this->assertTrue($entry->getGphotoVersion() instanceof Zend_Gdata_Photos_Extension_Version); + $this->verifyProperty2($entry, "gphotoVersion", "text", + "1190398778006402"); + $this->verifyProperty3($entry, "gphotoVersion", "text", + "1190398778006402"); + } + + /** + * Check for the existence of an <gphoto:albumid> and verify that it contains + * the expected value. + */ + public function testGphotoAlbumId() + { + $entry = $this->photoEntry; + + // Assert that the entry's albumid is correct + $this->assertTrue($entry->getGphotoAlbumId() instanceof Zend_Gdata_Photos_Extension_AlbumId); + $this->verifyProperty2($entry, "gphotoAlbumId", "text", + "1"); + $this->verifyProperty3($entry, "gphotoAlbumId", "text", + "1"); + } + + /** + * Check for the existence of an <gphoto:width> and verify that it contains + * the expected value. + */ + public function testGphotoWidth() + { + $entry = $this->photoEntry; + + // Assert that the entry's width is correct + $this->assertTrue($entry->getGphotoWidth() instanceof Zend_Gdata_Photos_Extension_Width); + $this->verifyProperty2($entry, "gphotoWidth", "text", + "2560"); + $this->verifyProperty3($entry, "gphotoWidth", "text", + "2560"); + } + + /** + * Check for the existence of an <gphoto:height> and verify that it contains + * the expected value. + */ + public function testGphotoHeight() + { + $entry = $this->photoEntry; + + // Assert that the entry's height is correct + $this->assertTrue($entry->getGphotoHeight() instanceof Zend_Gdata_Photos_Extension_Height); + $this->verifyProperty2($entry, "gphotoHeight", "text", + "1600"); + $this->verifyProperty3($entry, "gphotoHeight", "text", + "1600"); + } + + /** + * Check for the existence of an <gphoto:size> and verify that it contains + * the expected value. + */ + public function testGphotoSize() + { + $entry = $this->photoEntry; + + // Assert that the entry's size is correct + $this->assertTrue($entry->getGphotoSize() instanceof Zend_Gdata_Photos_Extension_Size); + $this->verifyProperty2($entry, "gphotoSize", "text", + "798334"); + $this->verifyProperty3($entry, "gphotoSize", "text", + "798334"); + } + + /** + * Check for the existence of an <gphoto:client> and verify that it contains + * the expected value. + */ + public function testGphotoClient() + { + $entry = $this->photoEntry; + + // Assert that the entry's client is correct + $this->assertTrue($entry->getGphotoClient() instanceof Zend_Gdata_Photos_Extension_Client); + $this->verifyProperty2($entry, "gphotoClient", "text", + ""); + $this->verifyProperty3($entry, "gphotoClient", "text", + ""); + } + + /** + * Check for the existence of an <gphoto:checksum> and verify that it contains + * the expected value. + */ + public function testGphotoChecksum() + { + $entry = $this->photoEntry; + + // Assert that the entry's checksum is correct + $this->assertTrue($entry->getGphotoChecksum() instanceof Zend_Gdata_Photos_Extension_Checksum); + $this->verifyProperty2($entry, "gphotoChecksum", "text", + ""); + $this->verifyProperty3($entry, "gphotoChecksum", "text", + ""); + } + + /** + * Check for the existence of an <gphoto:timestamp> and verify that it contains + * the expected value. + */ + public function testGphotoTimestamp() + { + $entry = $this->photoEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); + $this->verifyProperty2($entry, "gphotoTimestamp", "text", + "1189025363000"); + $this->verifyProperty3($entry, "gphotoTimestamp", "text", + "1189025363000"); + } + + /** + * Check for the existence of an <gphoto:commentingEnabled> and verify that it contains + * the expected value. + */ + public function testGphotoCommentingEnabled() + { + $entry = $this->photoEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); + $this->verifyProperty2($entry, "gphotoCommentingEnabled", "text", + "true"); + $this->verifyProperty3($entry, "gphotoCommentingEnabled", "text", + "true"); + } + + /** + * Check for the existence of an <gphoto:commentCount> and verify that it contains + * the expected value. + */ + public function testGphotoCommentCount() + { + $entry = $this->photoEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); + $this->verifyProperty2($entry, "gphotoCommentCount", "text", + "0"); + $this->verifyProperty3($entry, "gphotoCommentCount", "text", + "0"); + } + + /** + * Check for the existence of a <media:group> + */ + public function testMediaGroup() + { + $entry = $this->photoEntry; + + // Assert that the entry's media group exists + $this->assertTrue($entry->getMediaGroup() instanceof Zend_Gdata_Media_Extension_MediaGroup); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosPhotoFeedTest.php b/zend/tests/Zend/Gdata/Photos/PhotosPhotoFeedTest.php new file mode 100755 index 0000000..9f6e093 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosPhotoFeedTest.php @@ -0,0 +1,435 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/PhotoFeed.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosPhotoFeedTest extends PHPUnit_Framework_TestCase +{ + + protected $photoFeed = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $photoFeedText = file_get_contents( + '_files/TestPhotoFeed.xml', + true); + $this->photoFeed = new Zend_Gdata_Photos_PhotoFeed($photoFeedText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Verify that a given property is set to a specific value, + * that it keeps that value when set using the setter, + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty3($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $propSetter = "set" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + $secondSetter = "set" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $obj->$propSetter($obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Convert sample feed to XML then back to objects. Ensure that + * all objects are instances of appropriate entry type and object count matches. + */ + public function testPhotoFeedToAndFromString() + { + $entryCount = 0; + foreach ($this->photoFeed as $entry) { + $entryCount++; + $this->assertTrue($entry instanceof Zend_Gdata_Photos_CommentEntry || + $entry instanceof Zend_Gdata_Photos_TagEntry); + } + $this->assertTrue($entryCount > 0); + + /* Grab XML from $this->photoFeed and convert back to objects */ + $newListFeed = new Zend_Gdata_Photos_PhotoFeed( + $this->photoFeed->saveXML()); + $newEntryCount = 0; + foreach ($newListFeed as $entry) { + $newEntryCount++; + $this->assertTrue($entry instanceof Zend_Gdata_Photos_CommentEntry || + $entry instanceof Zend_Gdata_Photos_TagEntry); + } + $this->assertEquals($entryCount, $newEntryCount); + } + + /** + * Ensure that the number of entries equals the number + * of entries defined in the sample file. + */ + public function testEntryCount() + { + $entryCount = 0; + foreach ($this->photoFeed as $entry) { + $entryCount++; + } + $this->assertEquals(3, $entryCount); + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $feed = $this->photoFeed; + + // Assert that the feed's ID is correct + $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($feed, "id", "text", + "http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/100"); + + // Assert that all entries have an Atom ID object + foreach ($feed as $entry) { + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + } + + // Assert one of the entry's IDs + $entry = $feed[0]; + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/tag"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $feed = $this->photoFeed; + + // Assert that the feed's updated date is correct + $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($feed, "updated", "text", + "2007-09-21T18:23:05.000Z"); + + // Assert that all entries have an Atom Updated object + foreach ($feed as $entry) { + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + } + + // Assert one of the entry's Updated dates + $entry = $feed[0]; + $this->verifyProperty2($entry, "updated", "text", "2007-09-21T18:23:05.000Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $feed = $this->photoFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($feed, "title", "text", "Aqua Blue.jpg"); + + // Assert that all entries have an Atom ID object + foreach ($feed as $entry) { + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + } + } + + /** + * Check for the existence of an <atom:subtitle> and verify that it contains + * the expected value. + */ + public function testSubtitle() + { + $feed = $this->photoFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); + $this->verifyProperty2($feed, "subtitle", "text", + "Blue"); + } + + /** + * Check for the existence of an <atom:generator> and verify that it contains + * the expected value. + */ + public function testGenerator() + { + $feed = $this->photoFeed; + + // Assert that the feed's generator is correct + $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); + $this->verifyProperty2($feed, "generator", "version", "1.00"); + $this->verifyProperty2($feed, "generator", "uri", "http://picasaweb.google.com/"); + $this->verifyProperty2($feed, "generator", "text", "Picasaweb"); + } + + /** + * Check for the existence of an <atom:icon> and verify that it contains + * the expected value. + */ + public function testIcon() + { + $feed = $this->photoFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getIcon() instanceof Zend_Gdata_App_Extension_Icon); + $this->verifyProperty2($feed, "icon", "text", + "http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s288/Aqua%20Blue.jpg"); + } + + /** + * Check for the existence of an <gphoto:id> and verify that it contains + * the expected value. + */ + public function testGphotoId() + { + $feed = $this->photoFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoId() instanceof Zend_Gdata_Photos_Extension_Id); + $this->verifyProperty2($feed, "gphotoId", "text", + "100"); + $this->verifyProperty3($feed, "gphotoId", "text", + "100"); + } + + /** + * Check for the existence of an <gphoto:version> and verify that it contains + * the expected value. + */ + public function testGphotoVersion() + { + $feed = $this->photoFeed; + + // Assert that the feed's version is correct + $this->assertTrue($feed->getGphotoVersion() instanceof Zend_Gdata_Photos_Extension_Version); + $this->verifyProperty2($feed, "gphotoVersion", "text", + "1190398985145172"); + $this->verifyProperty3($feed, "gphotoVersion", "text", + "1190398985145172"); + } + + /** + * Check for the existence of an <gphoto:albumid> and verify that it contains + * the expected value. + */ + public function testGphotoAlbumId() + { + $feed = $this->photoFeed; + + // Assert that the feed's albumid is correct + $this->assertTrue($feed->getGphotoAlbumId() instanceof Zend_Gdata_Photos_Extension_AlbumId); + $this->verifyProperty2($feed, "gphotoAlbumId", "text", + "1"); + $this->verifyProperty3($feed, "gphotoAlbumId", "text", + "1"); + } + + /** + * Check for the existence of an <gphoto:timestamp> and verify that it contains + * the expected value. + */ + public function testGphotoTimestamp() + { + $feed = $this->photoFeed; + + // Assert that the feed's timestamp is correct + $this->assertTrue($feed->getGphotoTimestamp() instanceof Zend_Gdata_Photos_Extension_Timestamp); + $this->verifyProperty2($feed, "gphotoTimestamp", "text", + "1189025362000"); + $this->verifyProperty3($feed, "gphotoTimestamp", "text", + "1189025362000"); + } + + /** + * Check for the existence of an <gphoto:width> and verify that it contains + * the expected value. + */ + public function testGphotoWidth() + { + $feed = $this->photoFeed; + + // Assert that the feed's width is correct + $this->assertTrue($feed->getGphotoWidth() instanceof Zend_Gdata_Photos_Extension_Width); + $this->verifyProperty2($feed, "gphotoWidth", "text", + "2560"); + $this->verifyProperty3($feed, "gphotoWidth", "text", + "2560"); + } + + /** + * Check for the existence of an <gphoto:height> and verify that it contains + * the expected value. + */ + public function testGphotoHeight() + { + $feed = $this->photoFeed; + + // Assert that the feed's height is correct + $this->assertTrue($feed->getGphotoHeight() instanceof Zend_Gdata_Photos_Extension_Height); + $this->verifyProperty2($feed, "gphotoHeight", "text", + "1600"); + $this->verifyProperty3($feed, "gphotoHeight", "text", + "1600"); + } + + /** + * Check for the existence of an <gphoto:size> and verify that it contains + * the expected value. + */ + public function testGphotoSize() + { + $feed = $this->photoFeed; + + // Assert that the feed's size is correct + $this->assertTrue($feed->getGphotoSize() instanceof Zend_Gdata_Photos_Extension_Size); + $this->verifyProperty2($feed, "gphotoSize", "text", + "883405"); + $this->verifyProperty3($feed, "gphotoSize", "text", + "883405"); + } + + /** + * Check for the existence of an <gphoto:client> and verify that it contains + * the expected value. + */ + public function testGphotoClient() + { + $feed = $this->photoFeed; + + // Assert that the feed's client is correct + $this->assertTrue($feed->getGphotoClient() instanceof Zend_Gdata_Photos_Extension_Client); + $this->verifyProperty2($feed, "gphotoClient", "text", + ""); + $this->verifyProperty3($feed, "gphotoClient", "text", + ""); + } + + /** + * Check for the existence of an <gphoto:checksum> and verify that it contains + * the expected value. + */ + public function testGphotoChecksum() + { + $feed = $this->photoFeed; + + // Assert that the feed's checksum is correct + $this->assertTrue($feed->getGphotoChecksum() instanceof Zend_Gdata_Photos_Extension_Checksum); + $this->verifyProperty2($feed, "gphotoChecksum", "text", + ""); + $this->verifyProperty3($feed, "gphotoChecksum", "text", + ""); + } + + /** + * Check for the existence of an <gphoto:commentingEnabled> and verify that it contains + * the expected value. + */ + public function testGphotoCommentingEnabled() + { + $feed = $this->photoFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoCommentingEnabled() instanceof Zend_Gdata_Photos_Extension_CommentingEnabled); + $this->verifyProperty2($feed, "gphotoCommentingEnabled", "text", + "true"); + $this->verifyProperty3($feed, "gphotoCommentingEnabled", "text", + "true"); + } + + /** + * Check for the existence of an <gphoto:commentCount> and verify that it contains + * the expected value. + */ + public function testGphotoCommentCount() + { + $feed = $this->photoFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoCommentCount() instanceof Zend_Gdata_Photos_Extension_CommentCount); + $this->verifyProperty2($feed, "gphotoCommentCount", "text", + "1"); + $this->verifyProperty3($feed, "gphotoCommentCount", "text", + "1"); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosPhotoQueryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosPhotoQueryTest.php new file mode 100755 index 0000000..53f9f3e --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosPhotoQueryTest.php @@ -0,0 +1,133 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/PhotoQuery.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosPhotoQueryTest extends PHPUnit_Framework_TestCase +{ + + /** + * Check the consistency of a user feed request + */ + public function testSimplePhotoQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/1"; + + $query = new Zend_Gdata_Photos_PhotoQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setPhotoId("1"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check the consistency of a user feed request + * Projection is set to base + */ + public function testBasePhotoQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/base/user/sample.user/albumid/1/photoid/1"; + + $query = new Zend_Gdata_Photos_PhotoQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setPhotoId("1"); + $query->setProjection("base"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check for thrown exceptions upon improper photoid setting + */ + public function testPhotoQueryExceptions() + { + $query = new Zend_Gdata_Photos_PhotoQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + + try { + $generatedString = $query->getQueryUrl(); + } catch (Exception $e) { + $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); + } + } + + /** + * Check the consistency of a user feed request filtered + * for a specific tag + */ + public function testTagFilterPhotoQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/1?tag=test"; + + $query = new Zend_Gdata_Photos_PhotoQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setPhotoId("1"); + $query->setTag("test"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check the consistency of a user feed request for private data + */ + public function testPrivatePhotoQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/1?access=private"; + + $query = new Zend_Gdata_Photos_PhotoQuery(); + $query->setUser("sample.user"); + $query->setAlbumId("1"); + $query->setPhotoId("1"); + $query->setAccess("private"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosTagEntryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosTagEntryTest.php new file mode 100755 index 0000000..e3083a1 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosTagEntryTest.php @@ -0,0 +1,130 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/TagEntry.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosTagEntryTest extends PHPUnit_Framework_TestCase +{ + + protected $tagEntry = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $tagEntryText = file_get_contents( + '_files/TestTagEntry.xml', + true); + $this->tagEntry = new Zend_Gdata_Photos_TagEntry($tagEntryText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $entry = $this->tagEntry; + + // Assert that the entry's ID is correct + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user/tag/tag"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $entry = $this->tagEntry; + + // Assert that the entry's updated date is correct + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($entry, "updated", "text", + "1970-01-01T00:01:01.000Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $entry = $this->tagEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($entry, "title", "text", "tag"); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosUserEntryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosUserEntryTest.php new file mode 100755 index 0000000..089f3b5 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosUserEntryTest.php @@ -0,0 +1,228 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/UserEntry.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosUserEntryTest extends PHPUnit_Framework_TestCase +{ + + protected $userEntry = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $userEntryText = file_get_contents( + '_files/TestUserEntry.xml', + true); + $this->userEntry = new Zend_Gdata_Photos_UserEntry($userEntryText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Verify that a given property is set to a specific value, + * that it keeps that value when set using the setter, + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty3($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $propSetter = "set" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + $secondSetter = "set" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $obj->$propSetter($obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Check for the existence of an <atom:author> and verify that they + * contain the expected values. + */ + public function testAuthor() + { + $entry = $this->userEntry; + + // Assert that the entry's author is correct + $entryAuthor = $entry->getAuthor(); + $this->assertEquals($entryAuthor, $entry->author); + $this->assertEquals(1, count($entryAuthor)); + $this->assertTrue($entryAuthor[0] instanceof Zend_Gdata_App_Extension_Author); + $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); + $this->assertTrue($entryAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); + $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $entry = $this->userEntry; + + // Assert that the entry's ID is correct + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user"); + } + + /** + * Check for the existence of an <atom:published> and verify that it contains + * the expected value. + */ + public function testPublished() + { + $entry = $this->userEntry; + + // Assert that the photo entry has an Atom Published object + $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); + $this->verifyProperty2($entry, "published", "text", "2007-09-24T23:45:49.059Z"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $entry = $this->userEntry; + + // Assert that the entry's updated date is correct + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($entry, "updated", "text", + "2007-09-24T23:45:49.059Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $entry = $this->userEntry; + + // Assert that the entry's title is correct + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($entry, "title", "text", "sample.user"); + } + + /** + * Check for the existence of an <gphoto:user> and verify that it contains + * the expected value. + */ + public function testGphotoUser() + { + $entry = $this->userEntry; + + // Assert that the entry's user is correct + $this->assertTrue($entry->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); + $this->verifyProperty2($entry, "gphotoUser", "text", "sample.user"); + $this->verifyProperty3($entry, "gphotoUser", "text", "sample.user"); + } + + /** + * Check for the existence of an <gphoto:nickname> and verify that it contains + * the expected value. + */ + public function testGphotoNickname() + { + $entry = $this->userEntry; + + // Assert that the entry's nickname is correct + $this->assertTrue($entry->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); + $this->verifyProperty2($entry, "gphotoNickname", "text", "sample"); + $this->verifyProperty3($entry, "gphotoNickname", "text", "sample"); + } + + /** + * Check for the existence of an <gphoto:thumbnail> and verify that it contains + * the expected value. + */ + public function testGphotoThumbnail() + { + $entry = $this->userEntry; + + // Assert that the entry's thumbnail is correct + $this->assertTrue($entry->getGphotoThumbnail() instanceof Zend_Gdata_Photos_Extension_Thumbnail); + $this->verifyProperty2($entry, "gphotoThumbnail", "text", + "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); + $this->verifyProperty3($entry, "gphotoThumbnail", "text", + "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosUserFeedTest.php b/zend/tests/Zend/Gdata/Photos/PhotosUserFeedTest.php new file mode 100755 index 0000000..d40bebb --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosUserFeedTest.php @@ -0,0 +1,360 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/UserFeed.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosUserFeedTest extends PHPUnit_Framework_TestCase +{ + + protected $userFeed = null; + + /** + * Called before each test to setup any fixtures. + */ + public function setUp() + { + $userFeedText = file_get_contents( + '_files/TestUserFeed.xml', + true); + $this->userFeed = new Zend_Gdata_Photos_UserFeed($userFeedText); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param object $value The expected value of the property. + */ + protected function verifyProperty($obj, $name, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()); + } + + /** + * Verify that a given property is set to a specific value + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty2($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Verify that a given property is set to a specific value, + * that it keeps that value when set using the setter, + * and that the getter and magic variable return the same value. + * + * @param object $obj The object to be interrogated. + * @param string $name The name of the property to be verified. + * @param string $secondName 2nd level accessor function name + * @param object $value The expected value of the property. + */ + protected function verifyProperty3($obj, $name, $secondName, $value) + { + $propName = $name; + $propGetter = "get" . ucfirst($name); + $propSetter = "set" . ucfirst($name); + $secondGetter = "get" . ucfirst($secondName); + $secondSetter = "set" . ucfirst($secondName); + + $this->assertEquals($obj->$propGetter(), $obj->$propName); + $obj->$propSetter($obj->$propName); + $this->assertEquals($value, $obj->$propGetter()->$secondGetter()); + } + + /** + * Convert sample feed to XML then back to objects. Ensure that + * all objects are instances of appropriate entry type and object count matches. + */ + public function testUserFeedToAndFromString() + { + $entryCount = 0; + foreach ($this->userFeed as $entry) { + $entryCount++; + $this->assertTrue($entry instanceof Zend_Gdata_Photos_AlbumEntry || + $entry instanceof Zend_Gdata_Photos_PhotoEntry || + $entry instanceof Zend_Gdata_Photos_TagEntry); + } + $this->assertTrue($entryCount > 0); + + /* Grab XML from $this->userFeed and convert back to objects */ + $newListFeed = new Zend_Gdata_Photos_UserFeed( + $this->userFeed->saveXML()); + $newEntryCount = 0; + foreach ($newListFeed as $entry) { + $newEntryCount++; + $this->assertTrue($entry instanceof Zend_Gdata_Photos_AlbumEntry || + $entry instanceof Zend_Gdata_Photos_PhotoEntry || + $entry instanceof Zend_Gdata_Photos_TagEntry); + } + $this->assertEquals($entryCount, $newEntryCount); + } + + /** + * Ensure that the number of entries equals the number + * of entries defined in the sample file. + */ + public function testEntryCount() + { + $entryCount = 0; + foreach ($this->userFeed as $entry) { + $entryCount++; + } + $this->assertEquals(3, $entryCount); + } + + /** + * Check for the existence of an <atom:author> and verify that they + * contain the expected values. + */ + public function testAuthor() + { + $feed = $this->userFeed; + + // Assert that the feed's author is correct + $feedAuthor = $feed->getAuthor(); + $this->assertEquals($feedAuthor, $feed->author); + $this->assertEquals(1, count($feedAuthor)); + $this->assertTrue($feedAuthor[0] instanceof Zend_Gdata_App_Extension_Author); + $this->verifyProperty2($feedAuthor[0], "name", "text", "sample"); + $this->assertTrue($feedAuthor[0]->getUri() instanceof Zend_Gdata_App_Extension_Uri); + $this->verifyProperty2($feedAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); + + // Assert that each entry has valid author data + foreach ($feed as $entry) { + if ($entry instanceof Zend_Gdata_Photos_AlbumEntry) { + $entryAuthor = $entry->getAuthor(); + $this->assertEquals(1, count($entryAuthor)); + $this->verifyProperty2($entryAuthor[0], "name", "text", "sample"); + $this->verifyProperty2($entryAuthor[0], "uri", "text", "http://picasaweb.google.com/sample.user"); + } + } + } + + /** + * Check for the existence of an <atom:id> and verify that it contains + * the expected value. + */ + public function testId() + { + $feed = $this->userFeed; + + // Assert that the feed's ID is correct + $this->assertTrue($feed->getId() instanceof Zend_Gdata_App_Extension_Id); + $this->verifyProperty2($feed, "id", "text", + "http://picasaweb.google.com/data/feed/api/user/sample.user"); + + // Assert that all entries have an Atom ID object + foreach ($feed as $entry) { + $this->assertTrue($entry->getId() instanceof Zend_Gdata_App_Extension_Id); + } + + // Assert one of the entry's IDs + $entry = $feed[0]; + $this->verifyProperty2($entry, "id", "text", + "http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100"); + } + + /** + * Check for the existence of an <atom:published> and verify that it contains + * the expected value. + */ + public function testPublished() + { + $feed = $this->userFeed; + + // Assert that all entries have an Atom Published object + foreach ($feed as $entry) { + $this->assertTrue($entry->getPublished() instanceof Zend_Gdata_App_Extension_Published); + } + + // Assert one of the entry's Published dates + $entry = $feed[0]; + $this->verifyProperty2($entry, "published", "text", "2007-09-05T07:00:00.000Z"); + } + + /** + * Check for the existence of an <atom:updated> and verify that it contains + * the expected value. + */ + public function testUpdated() + { + $feed = $this->userFeed; + + // Assert that the feed's updated date is correct + $this->assertTrue($feed->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + $this->verifyProperty2($feed, "updated", "text", + "2007-09-20T21:09:39.111Z"); + + // Assert that all entries have an Atom Updated object + foreach ($feed as $entry) { + $this->assertTrue($entry->getUpdated() instanceof Zend_Gdata_App_Extension_Updated); + } + + // Assert one of the entry's Updated dates + $entry = $feed[0]; + $this->verifyProperty2($entry, "updated", "text", "2007-09-05T20:49:24.000Z"); + } + + /** + * Check for the existence of an <atom:title> and verify that it contains + * the expected value. + */ + public function testTitle() + { + $feed = $this->userFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getTitle() instanceof Zend_Gdata_App_Extension_Title); + $this->verifyProperty2($feed, "title", "text", + "sample.user"); + + // Assert that all entries have an Atom ID object + foreach ($feed as $entry) { + $this->assertTrue($entry->getTitle() instanceof Zend_Gdata_App_Extension_Title); + } + + // Assert one of the entry's Titles + $entry = $feed[0]; + $this->verifyProperty2($entry, "title", "text", "Test"); + } + + /** + * Check for the existence of an <atom:subtitle> and verify that it contains + * the expected value. + */ + public function testSubtitle() + { + $feed = $this->userFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getSubtitle() instanceof Zend_Gdata_App_Extension_Subtitle); + $this->verifyProperty2($feed, "subtitle", "text", + ""); + } + + /** + * Check for the existence of an <atom:generator> and verify that it contains + * the expected value. + */ + public function testGenerator() + { + $feed = $this->userFeed; + + // Assert that the feed's generator is correct + $this->assertTrue($feed->getGenerator() instanceof Zend_Gdata_App_Extension_Generator); + $this->verifyProperty2($feed, "generator", "version", "1.00"); + $this->verifyProperty2($feed, "generator", "uri", "http://picasaweb.google.com/"); + $this->verifyProperty2($feed, "generator", "text", "Picasaweb"); + } + + /** + * Check for the existence of an <atom:icon> and verify that it contains + * the expected value. + */ + public function testIcon() + { + $feed = $this->userFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getIcon() instanceof Zend_Gdata_App_Extension_Icon); + $this->verifyProperty2($feed, "icon", "text", + "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); + } + + /** + * Check for the existence of an <gphoto:user> and verify that it contains + * the expected value. + */ + public function testGphotoUser() + { + $feed = $this->userFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoUser() instanceof Zend_Gdata_Photos_Extension_User); + $this->verifyProperty2($feed, "gphotoUser", "text", + "sample.user"); + $this->verifyProperty3($feed, "gphotoUser", "text", + "sample.user"); + } + + /** + * Check for the existence of an <gphoto:nickname> and verify that it contains + * the expected value. + */ + public function testGphotoNickname() + { + $feed = $this->userFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoNickname() instanceof Zend_Gdata_Photos_Extension_Nickname); + $this->verifyProperty2($feed, "gphotoNickname", "text", + "sample"); + $this->verifyProperty3($feed, "gphotoNickname", "text", + "sample"); + } + + /** + * Check for the existence of an <gphoto:thumbnail> and verify that it contains + * the expected value. + */ + public function testGphotoThumbnail() + { + $feed = $this->userFeed; + + // Assert that the feed's title is correct + $this->assertTrue($feed->getGphotoThumbnail() instanceof Zend_Gdata_Photos_Extension_Thumbnail); + $this->verifyProperty2($feed, "gphotoThumbnail", "text", + "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); + $this->verifyProperty3($feed, "gphotoThumbnail", "text", + "http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user"); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/PhotosUserQueryTest.php b/zend/tests/Zend/Gdata/Photos/PhotosUserQueryTest.php new file mode 100755 index 0000000..8b57da1 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/PhotosUserQueryTest.php @@ -0,0 +1,134 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id $ + */ + +require_once 'Zend/Gdata/Photos.php'; +require_once 'Zend/Gdata/Photos/UserQuery.php'; +require_once 'Zend/Http/Client.php'; +require_once 'Zend/Http/Client/Adapter/Test.php'; + +/** + * @category Zend + * @package Zend_Gdata_Photos + * @subpackage UnitTests + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @group Zend_Gdata + * @group Zend_Gdata_Photos + */ +class Zend_Gdata_Photos_PhotosUserQueryTest extends PHPUnit_Framework_TestCase +{ + + /** + * Check the consistency of a user feed request + */ + public function testSimpleUserQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user"; + + $query = new Zend_Gdata_Photos_UserQuery(); + $query->setUser("sample.user"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check the consistency of a user feed request + * Projection is set to base + */ + public function testBaseUserQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/base/user/sample.user"; + + $query = new Zend_Gdata_Photos_UserQuery(); + $query->setUser("sample.user"); + $query->setProjection("base"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * Check for thrown exceptions upon improper albumname/id setting + */ + public function testUserQueryExceptions() + { + $query = new Zend_Gdata_Photos_UserQuery(); + $query->setUser("sample.user"); + $query->setProjection(null); + + try { + $generatedString = $query->getQueryUrl(); + } catch (Exception $e) { + $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); + } + + $query->setProjection("api"); + $query->setUser(null); + + try { + $generatedString = $query->getQueryUrl(); + } catch (Exception $e) { + $this->assertTrue($e instanceof Zend_Gdata_App_InvalidArgumentException); + } + } + + /** + * Check the consistency of a user feed request filtered + * for a specific tag + */ + public function testTagFilterUserQuery() + { + $queryString = "https://picasaweb.google.com/data/feed/api/user/sample.user?tag=test"; + + $query = new Zend_Gdata_Photos_UserQuery(); + $query->setUser("sample.user"); + $query->setTag("test"); + + $generatedString = $query->getQueryUrl(); + + // Assert that the generated query matches the correct one + $this->assertEquals($queryString, $generatedString); + } + + /** + * 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 Zend_Gdata_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); + } + +} diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestAlbumEntry.xml b/zend/tests/Zend/Gdata/Photos/_files/TestAlbumEntry.xml new file mode 100755 index 0000000..70bef7a --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestAlbumEntry.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns="http://www.w3.org/2005/Atom" xmlns:exif="http://schemas.google.com/photos/exif/2007" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" xmlns:photo="http://www.pheed.com/pheed/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1</id> + <published>2007-09-05T07:00:00.000Z</published> + <updated>2007-09-05T20:49:24.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#album"/> + <title type="text">Test</title> + <summary type="text"/> + <rights type="text">public</rights> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + <gphoto:id>1</gphoto:id> + <gphoto:name>Test</gphoto:name> + <gphoto:location/> + <gphoto:access>public</gphoto:access> + <gphoto:timestamp>1188975600000</gphoto:timestamp> + <gphoto:numphotos>2</gphoto:numphotos> + <gphoto:user>sample.user</gphoto:user> + <gphoto:nickname>sample</gphoto:nickname> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>0</gphoto:commentCount> + <media:group> + <media:title type="plain">Test</media:title> + <media:description type="plain"/> + <media:keywords/> + <media:content url="http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/Test.jpg" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/s160-c/Test.jpg" height="160" width="160"/> + <media:credit>sample</media:credit> + </media:group> + <georss:where> + <gml:Point> + <gml:pos>42.87194 13.56738</gml:pos> + </gml:Point> + </georss:where> +</entry> diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestAlbumFeed.xml b/zend/tests/Zend/Gdata/Photos/_files/TestAlbumFeed.xml new file mode 100755 index 0000000..b8758a3 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestAlbumFeed.xml @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:exif="http://schemas.google.com/photos/exif/2007" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" xmlns:photo="http://www.pheed.com/pheed/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1</id> + <updated>2007-09-21T18:23:05.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#album"/> + <title type="text">Test</title> + <subtitle type="text"/> + <rights type="text">public</rights> + <icon>http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/s160-c/Test.jpg</icon> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test"/> + <link rel="http://schemas.google.com/photos/2007#slideshow" type="application/x-shockwave-flash" href="http://picasaweb.google.com/s/c/bin/slideshow.swf?host=picasaweb.google.com&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fsample.user%2Falbumid%2F1%3Falt%3Drss"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1?start-index=1&max-results=500&kind=photo%2Ctag"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + <generator version="1.00" uri="http://picasaweb.google.com/">Picasaweb</generator> + <openSearch:totalResults>4</openSearch:totalResults> + <openSearch:startIndex>1</openSearch:startIndex> + <openSearch:itemsPerPage>500</openSearch:itemsPerPage> + <gphoto:id>1</gphoto:id> + <gphoto:name>Test</gphoto:name> + <gphoto:location/> + <gphoto:access>public</gphoto:access> + <gphoto:timestamp>1188975600000</gphoto:timestamp> + <gphoto:numphotos>2</gphoto:numphotos> + <gphoto:user>sample.user</gphoto:user> + <gphoto:nickname>sample</gphoto:nickname> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>0</gphoto:commentCount> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/2</id> + <published>2007-09-05T20:49:23.000Z</published> + <updated>2007-09-21T18:23:05.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> + <title type="text">Aqua Blue.jpg</title> + <summary type="text">Blue</summary> + <content type="image/jpeg" src="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/Aqua%20Blue.jpg"/> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/2"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#2"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/2"/> + <gphoto:id>2</gphoto:id> + <gphoto:version>1190398985145172</gphoto:version> + <gphoto:position>0.0</gphoto:position> + <gphoto:albumid>1</gphoto:albumid> + <gphoto:width>2560</gphoto:width> + <gphoto:height>1600</gphoto:height> + <gphoto:size>883405</gphoto:size> + <gphoto:client/> + <gphoto:checksum/> + <gphoto:timestamp>1189025362000</gphoto:timestamp> + <exif:tags> + <exif:flash>true</exif:flash> + <exif:imageUniqueID>c041ce17aaa637eb656c81d9cf526c24</exif:imageUniqueID> + </exif:tags> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>1</gphoto:commentCount> + <media:group> + <media:title type="plain">Aqua Blue.jpg</media:title> + <media:description type="plain">Blue</media:description> + <media:keywords>tag, test</media:keywords> + <media:content url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/Aqua%20Blue.jpg" height="1600" width="2560" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s72/Aqua%20Blue.jpg" height="45" width="72"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s144/Aqua%20Blue.jpg" height="90" width="144"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s288/Aqua%20Blue.jpg" height="180" width="288"/> + <media:credit>sample</media:credit> + </media:group> + <georss:where> + <gml:Point> + <gml:pos>41.87194 12.56738</gml:pos> + </gml:Point> + </georss:where> + </entry> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/3</id> + <published>2007-09-05T20:49:24.000Z</published> + <updated>2007-09-21T18:19:38.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> + <title type="text">Aqua Graphite.jpg</title> + <summary type="text">Gray</summary> + <content type="image/jpeg" src="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/Aqua%20Graphite.jpg"/> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/3"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#3"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/3"/> + <gphoto:id>3</gphoto:id> + <gphoto:version>1190398778006402</gphoto:version> + <gphoto:position>1.0</gphoto:position> + <gphoto:albumid>1</gphoto:albumid> + <gphoto:width>2560</gphoto:width> + <gphoto:height>1600</gphoto:height> + <gphoto:size>798334</gphoto:size> + <gphoto:client/> + <gphoto:checksum/> + <gphoto:timestamp>1189025363000</gphoto:timestamp> + <exif:tags> + <exif:flash>true</exif:flash> + <exif:imageUniqueID>a5ce2e36b9df7d3cb081511c72e73926</exif:imageUniqueID> + </exif:tags> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>0</gphoto:commentCount> + <media:group> + <media:title type="plain">Aqua Graphite.jpg</media:title> + <media:description type="plain">Gray</media:description> + <media:keywords/> + <media:content url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/Aqua%20Graphite.jpg" height="1600" width="2560" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s72/Aqua%20Graphite.jpg" height="45" width="72"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s144/Aqua%20Graphite.jpg" height="90" width="144"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s288/Aqua%20Graphite.jpg" height="180" width="288"/> + <media:credit>sample</media:credit> + </media:group> + </entry> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/tag/tag</id> + <updated>2007-09-05T20:49:24.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#tag"/> + <title type="text">tag</title> + <summary type="text">tag</summary> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/lh/searchbrowse?q=tag&psc=G&uname=sample.user&filter=0"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/tag/tag"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + </entry> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/tag/test</id> + <updated>2007-09-05T20:49:24.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#tag"/> + <title type="text">test</title> + <summary type="text">test</summary> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/lh/searchbrowse?q=test&psc=G&uname=sample.user&filter=0"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/tag/test"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + </entry> +</feed> diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestCommentEntry.xml b/zend/tests/Zend/Gdata/Photos/_files/TestCommentEntry.xml new file mode 100755 index 0000000..5b3d423 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestCommentEntry.xml @@ -0,0 +1,21 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5</id> + <published>2007-09-21T18:22:53.000Z</published> + <updated>2007-09-21T18:22:53.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#comment"/> + <title type="text">sample</title> + <summary type="text">test comment</summary> + <content type="text">test comment</content> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#100"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + <gphoto:user>sample.user</gphoto:user> + <gphoto:nickname>sample</gphoto:nickname> + <gphoto:thumbnail>http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s48-c/sample.user</gphoto:thumbnail> + </author> + <gphoto:id>5</gphoto:id> + <gphoto:photoid>100</gphoto:photoid> +</entry> diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestPhotoEntry.xml b/zend/tests/Zend/Gdata/Photos/_files/TestPhotoEntry.xml new file mode 100755 index 0000000..2f6e4b5 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestPhotoEntry.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns="http://www.w3.org/2005/Atom" xmlns:exif="http://schemas.google.com/photos/exif/2007" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" xmlns:photo="http://www.pheed.com/pheed/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100</id> + <published>2007-09-05T20:49:24.000Z</published> + <updated>2007-09-21T18:19:38.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> + <title type="text">Aqua Graphite.jpg</title> + <summary type="text">Gray</summary> + <content type="image/jpeg" src="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/Aqua%20Graphite.jpg"/> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/100"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#100"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100"/> + <gphoto:id>100</gphoto:id> + <gphoto:version>1190398778006402</gphoto:version> + <gphoto:albumid>1</gphoto:albumid> + <gphoto:width>2560</gphoto:width> + <gphoto:height>1600</gphoto:height> + <gphoto:size>798334</gphoto:size> + <gphoto:client/> + <gphoto:checksum/> + <gphoto:timestamp>1189025363000</gphoto:timestamp> + <exif:tags> + <exif:fstop>11.0</exif:fstop> + <exif:exposure>0.0040</exif:exposure> + <exif:flash>true</exif:flash> + <exif:focallength>22.0</exif:focallength> + <exif:iso>200</exif:iso> + <exif:time>1180950900000</exif:time> + <exif:imageUniqueID>a5ce2e36b9df7d3cb081511c72e73926</exif:imageUniqueID> + <exif:distance>0.0</exif:distance> + <exif:make>Fictitious Camera Company</exif:make> + <exif:model>AMAZING-100D</exif:model> + </exif:tags> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>0</gphoto:commentCount> + <media:group> + <media:title type="plain">Aqua Graphite.jpg</media:title> + <media:description type="plain">Gray</media:description> + <media:keywords/> + <media:content url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/Aqua%20Graphite.jpg" height="1600" width="2560" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s72/Aqua%20Graphite.jpg" height="45" width="72"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s144/Aqua%20Graphite.jpg" height="90" width="144"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s288/Aqua%20Graphite.jpg" height="180" width="288"/> + <media:credit>sample</media:credit> + </media:group> + <georss:where> + <gml:Point> + <gml:pos>41.87194 12.56738</gml:pos> + </gml:Point> + </georss:where> +</entry> diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestPhotoFeed.xml b/zend/tests/Zend/Gdata/Photos/_files/TestPhotoFeed.xml new file mode 100755 index 0000000..ea3fb8f --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestPhotoFeed.xml @@ -0,0 +1,87 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:exif="http://schemas.google.com/photos/exif/2007" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" xmlns:photo="http://www.pheed.com/pheed/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/100</id> + <updated>2007-09-21T18:23:05.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> + <title type="text">Aqua Blue.jpg</title> + <subtitle type="text">Blue</subtitle> + <icon>http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s288/Aqua%20Blue.jpg</icon> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/100"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#100"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/1/photoid/100?start-index=1&max-results=500&kind=tag%2Ccomment"/> + <generator version="1.00" uri="http://picasaweb.google.com/">Picasaweb</generator> + <openSearch:totalResults>3</openSearch:totalResults> + <openSearch:startIndex>1</openSearch:startIndex> + <openSearch:itemsPerPage>500</openSearch:itemsPerPage> + <gphoto:id>100</gphoto:id> + <gphoto:version>1190398985145172</gphoto:version> + <gphoto:albumid>1</gphoto:albumid> + <gphoto:width>2560</gphoto:width> + <gphoto:height>1600</gphoto:height> + <gphoto:size>883405</gphoto:size> + <gphoto:client/> + <gphoto:checksum/> + <gphoto:timestamp>1189025362000</gphoto:timestamp> + <exif:tags> + <exif:flash>true</exif:flash> + <exif:imageUniqueID>c041ce17aaa637eb656c81d9cf526c24</exif:imageUniqueID> + </exif:tags> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>1</gphoto:commentCount> + <media:group> + <media:title type="plain">Aqua Blue.jpg</media:title> + <media:description type="plain">Blue</media:description> + <media:keywords>tag, test</media:keywords> + <media:content url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/Aqua%20Blue.jpg" height="1600" width="2560" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s72/Aqua%20Blue.jpg" height="45" width="72"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s144/Aqua%20Blue.jpg" height="90" width="144"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s288/Aqua%20Blue.jpg" height="180" width="288"/> + <media:credit>sample</media:credit> + </media:group> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/tag</id> + <updated>2007-09-21T18:23:05.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#tag"/> + <title type="text">tag</title> + <summary type="text">tag</summary> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/lh/searchbrowse?q=tag&psc=G&uname=sample.user&filter=0"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/tag"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + </entry> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/test</id> + <updated>2007-09-21T18:23:05.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#tag"/> + <title type="text">test</title> + <summary type="text">test</summary> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/lh/searchbrowse?q=test&psc=G&uname=sample.user&filter=0"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/tag/test"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + </entry> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5</id> + <published>2007-09-21T18:22:53.000Z</published> + <updated>2007-09-21T18:22:53.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#comment"/> + <title type="text">sample</title> + <summary type="text">test comment</summary> + <content type="text">test comment</content> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#100"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/1/photoid/100/commentid/5"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + <gphoto:user>sample.user</gphoto:user> + <gphoto:nickname>sample</gphoto:nickname> + <gphoto:thumbnail>http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s48-c/sample.user</gphoto:thumbnail> + </author> + <gphoto:id>5</gphoto:id> + <gphoto:photoid>100</gphoto:photoid> + </entry> +</feed> diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestTagEntry.xml b/zend/tests/Zend/Gdata/Photos/_files/TestTagEntry.xml new file mode 100755 index 0000000..6e00dd5 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestTagEntry.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/tag/tag</id> + <updated>1970-01-01T00:01:01.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#tag"/> + <title type="text">tag</title> + <summary type="text">tag</summary> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/lh/searchbrowse?q=tag&psc=G&uname=sample.user&filter=0"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/tag/tag"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> +</entry> diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestUserEntry.xml b/zend/tests/Zend/Gdata/Photos/_files/TestUserEntry.xml new file mode 100755 index 0000000..759818c --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestUserEntry.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<entry xmlns="http://www.w3.org/2005/Atom" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" xmlns:photo="http://www.pheed.com/pheed/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user</id> + <published>2007-09-24T23:45:49.059Z</published> + <updated>2007-09-24T23:45:49.059Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#user"/> + <title type="text">sample.user</title> + <summary type="text"/> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + <gphoto:user>sample.user</gphoto:user> + <gphoto:nickname>sample</gphoto:nickname> + <gphoto:thumbnail>http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user</gphoto:thumbnail> +</entry> diff --git a/zend/tests/Zend/Gdata/Photos/_files/TestUserFeed.xml b/zend/tests/Zend/Gdata/Photos/_files/TestUserFeed.xml new file mode 100755 index 0000000..58dd6b4 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/TestUserFeed.xml @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="UTF-8"?> +<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:gml="http://www.opengis.net/gml" xmlns:georss="http://www.georss.org/georss" xmlns:photo="http://www.pheed.com/pheed/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gphoto="http://schemas.google.com/photos/2007"> + <id>http://picasaweb.google.com/data/feed/api/user/sample.user</id> + <updated>2007-09-20T21:09:39.111Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#user"/> + <title type="text">sample.user</title> + <subtitle type="text"/> + <icon>http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user</icon> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user"/> + <link rel="http://schemas.google.com/photos/2007#slideshow" type="application/x-shockwave-flash" href="http://picasaweb.google.com/s/c/bin/slideshow.swf?host=picasaweb.google.com&RGB=0x000000&feed=http%3A%2F%2Fpicasaweb.google.com%2Fdata%2Ffeed%2Fapi%2Fuser%2Fsample.user%3Falt%3Drss"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user?start-index=1&max-results=100&kind=album%2Cphoto%2Ctag"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + <generator version="1.00" uri="http://picasaweb.google.com/">Picasaweb</generator> + <openSearch:totalResults>4</openSearch:totalResults> + <openSearch:startIndex>1</openSearch:startIndex> + <openSearch:itemsPerPage>100</openSearch:itemsPerPage> + <gphoto:user>sample.user</gphoto:user> + <gphoto:nickname>sample</gphoto:nickname> + <gphoto:thumbnail>http://lh5.google.com/sample.user/AAAAuZnob5E/AAAAAAAAAAA/EtCbNCdLGxM/s64-c/sample.user</gphoto:thumbnail> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100</id> + <published>2007-09-05T07:00:00.000Z</published> + <updated>2007-09-05T20:49:24.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#album"/> + <title type="text">Test</title> + <summary type="text"/> + <rights type="text">public</rights> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/100"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100"/> + <author> + <name>sample</name> + <uri>http://picasaweb.google.com/sample.user</uri> + </author> + <gphoto:id>100</gphoto:id> + <gphoto:name>Test</gphoto:name> + <gphoto:location/> + <gphoto:access>public</gphoto:access> + <gphoto:timestamp>1188975600000</gphoto:timestamp> + <gphoto:numphotos>2</gphoto:numphotos> + <gphoto:user>sample.user</gphoto:user> + <gphoto:nickname>sample</gphoto:nickname> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>0</gphoto:commentCount> + <media:group> + <media:title type="plain">Test</media:title> + <media:description type="plain"/> + <media:keywords/> + <media:content url="http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/Test.jpg" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh6.google.com/sample.user/Rt8WNoDZEJE/AAAAAAAAABk/HQGlDhpIgWo/s160-c/Test.jpg" height="160" width="160"/> + <media:credit>sample</media:credit> + </media:group> + </entry> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100/photoid/2</id> + <published>2007-09-05T20:49:24.000Z</published> + <updated>2007-09-05T20:49:23.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> + <title type="text">Second.jpg</title> + <summary type="text"/> + <content type="image/jpeg" src="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/Aqua%20Graphite.jpg"/> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/100/photoid/2"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#2"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100/photoid/2"/> + <gphoto:id>2</gphoto:id> + <gphoto:version>1189025363424891</gphoto:version> + <gphoto:albumid>100</gphoto:albumid> + <gphoto:width>2560</gphoto:width> + <gphoto:height>1600</gphoto:height> + <gphoto:size>798334</gphoto:size> + <gphoto:client/> + <gphoto:checksum/> + <gphoto:timestamp>1189025363000</gphoto:timestamp> + <exif:tags xmlns:exif="http://schemas.google.com/photos/exif/2007"> + <exif:flash>true</exif:flash> + <exif:imageUniqueID>a5ce2e36b9df7d3cb081511c72e73926</exif:imageUniqueID> + </exif:tags> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>0</gphoto:commentCount> + <media:group> + <media:title type="plain">Second.jpg</media:title> + <media:description type="plain"/> + <media:keywords/> + <media:content url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/Aqua%20Graphite.jpg" height="1600" width="2560" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s72/Aqua%20Graphite.jpg" height="45" width="72"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s144/Aqua%20Graphite.jpg" height="90" width="144"/> + <media:thumbnail url="http://lh5.google.com/sample.user/Rt8WVIDZELI/AAAAAAAAABg/d7e0i7gvhNU/s288/Aqua%20Graphite.jpg" height="180" width="288"/> + <media:credit>sample</media:credit> + </media:group> + </entry> + <entry> + <id>http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100/photoid/1</id> + <published>2007-09-05T20:49:23.000Z</published> + <updated>2007-09-05T20:49:22.000Z</updated> + <category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/photos/2007#photo"/> + <title type="text">First.jpg</title> + <summary type="text"/> + <content type="image/jpeg" src="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/Aqua%20Blue.jpg"/> + <link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://picasaweb.google.com/data/feed/api/user/sample.user/albumid/100/photoid/1"/> + <link rel="alternate" type="text/html" href="http://picasaweb.google.com/sample.user/Test/photo#1"/> + <link rel="self" type="application/atom+xml" href="http://picasaweb.google.com/data/entry/api/user/sample.user/albumid/100/photoid/1"/> + <gphoto:id>1</gphoto:id> + <gphoto:version>1189025362423722</gphoto:version> + <gphoto:albumid>100</gphoto:albumid> + <gphoto:width>2560</gphoto:width> + <gphoto:height>1600</gphoto:height> + <gphoto:size>883405</gphoto:size> + <gphoto:client/> + <gphoto:checksum/> + <gphoto:timestamp>1189025362000</gphoto:timestamp> + <exif:tags xmlns:exif="http://schemas.google.com/photos/exif/2007"> + <exif:flash>true</exif:flash> + <exif:imageUniqueID>c041ce17aaa637eb656c81d9cf526c24</exif:imageUniqueID> + </exif:tags> + <gphoto:commentingEnabled>true</gphoto:commentingEnabled> + <gphoto:commentCount>0</gphoto:commentCount> + <media:group> + <media:title type="plain">First.jpg</media:title> + <media:description type="plain"/> + <media:keywords/> + <media:content url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/Aqua%20Blue.jpg" height="1600" width="2560" type="image/jpeg" medium="image"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s72/Aqua%20Blue.jpg" height="45" width="72"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s144/Aqua%20Blue.jpg" height="90" width="144"/> + <media:thumbnail url="http://lh4.google.com/sample.user/Rt8WU4DZEKI/AAAAAAAAABY/IVgLqmnzJII/s288/Aqua%20Blue.jpg" height="180" width="288"/> + <media:credit>sample</media:credit> + </media:group> + </entry> +</feed> diff --git a/zend/tests/Zend/Gdata/Photos/_files/test.jpg b/zend/tests/Zend/Gdata/Photos/_files/test.jpg Binary files differnew file mode 100755 index 0000000..d4a5a10 --- /dev/null +++ b/zend/tests/Zend/Gdata/Photos/_files/test.jpg |
