summaryrefslogtreecommitdiff
path: root/zend/tests/Zend/Gdata/Gapps
diff options
context:
space:
mode:
authorHorus32014-02-24 16:42:14 +0100
committerHorus32014-02-24 16:42:14 +0100
commit06f945f27840b53e57795dadbc38e76f7e11ab1c (patch)
tree689d5c7f4ffa15460c7e90f47c6a7dd59ce4e8bd /zend/tests/Zend/Gdata/Gapps
downloadrandom-06f945f27840b53e57795dadbc38e76f7e11ab1c.tar.gz
init
Diffstat (limited to 'zend/tests/Zend/Gdata/Gapps')
-rw-r--r--zend/tests/Zend/Gdata/Gapps/EmailListEntryTest.php140
-rw-r--r--zend/tests/Zend/Gdata/Gapps/EmailListFeedTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/EmailListQueryTest.php138
-rw-r--r--zend/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php107
-rw-r--r--zend/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php90
-rw-r--r--zend/tests/Zend/Gdata/Gapps/EmailListTest.php126
-rw-r--r--zend/tests/Zend/Gdata/Gapps/ErrorTest.php88
-rw-r--r--zend/tests/Zend/Gdata/Gapps/GroupEntryTest.php110
-rw-r--r--zend/tests/Zend/Gdata/Gapps/GroupFeedTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/GroupQueryTest.php168
-rw-r--r--zend/tests/Zend/Gdata/Gapps/LoginTest.php169
-rw-r--r--zend/tests/Zend/Gdata/Gapps/MemberEntryTest.php108
-rw-r--r--zend/tests/Zend/Gdata/Gapps/MemberFeedTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/MemberQueryTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/NameTest.php133
-rw-r--r--zend/tests/Zend/Gdata/Gapps/NicknameEntryTest.php112
-rw-r--r--zend/tests/Zend/Gdata/Gapps/NicknameFeedTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/NicknameQueryTest.php140
-rw-r--r--zend/tests/Zend/Gdata/Gapps/NicknameTest.php126
-rw-r--r--zend/tests/Zend/Gdata/Gapps/OwnerEntryTest.php104
-rw-r--r--zend/tests/Zend/Gdata/Gapps/OwnerFeedTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/OwnerQueryTest.php91
-rw-r--r--zend/tests/Zend/Gdata/Gapps/PropertyTest.php133
-rw-r--r--zend/tests/Zend/Gdata/Gapps/QuotaTest.php126
-rw-r--r--zend/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php128
-rw-r--r--zend/tests/Zend/Gdata/Gapps/UserEntryTest.php145
-rw-r--r--zend/tests/Zend/Gdata/Gapps/UserFeedTest.php109
-rw-r--r--zend/tests/Zend/Gdata/Gapps/UserQueryTest.php98
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml6
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml2
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml17
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml55
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml15
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml51
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml14
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml31
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml2
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml13
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml29
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml2
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml2
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml16
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml50
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml10
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml30
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml2
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml2
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml20
-rw-r--r--zend/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml66
50 files changed, 3887 insertions, 0 deletions
diff --git a/zend/tests/Zend/Gdata/Gapps/EmailListEntryTest.php b/zend/tests/Zend/Gdata/Gapps/EmailListEntryTest.php
new file mode 100644
index 0000000..f410e83
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/EmailListEntryTest.php
@@ -0,0 +1,140 @@
+<?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_Gapps
+ * @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/Gapps/EmailListEntry.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_EmailListEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->entryText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml',
+ true);
+ $this->entry = new Zend_Gdata_Gapps_EmailListEntry();
+ }
+
+ private function verifyAllSamplePropertiesAreCorrect ($emailListEntry) {
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales',
+ $emailListEntry->id->text);
+ $this->assertEquals('1970-01-01T00:00:00.000Z', $emailListEntry->updated->text);
+ $this->assertEquals('http://schemas.google.com/g/2005#kind', $emailListEntry->category[0]->scheme);
+ $this->assertEquals('http://schemas.google.com/apps/2006#emailList', $emailListEntry->category[0]->term);
+ $this->assertEquals('text', $emailListEntry->title->type);
+ $this->assertEquals('us-sales', $emailListEntry->title->text);;
+ $this->assertEquals('self', $emailListEntry->getLink('self')->rel);
+ $this->assertEquals('application/atom+xml', $emailListEntry->getLink('self')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales', $emailListEntry->getLink('self')->href);
+ $this->assertEquals('edit', $emailListEntry->getLink('edit')->rel);
+ $this->assertEquals('application/atom+xml', $emailListEntry->getLink('edit')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales', $emailListEntry->getLink('edit')->href);
+ $this->assertEquals('us-sales', $emailListEntry->emailList->name);
+ $this->assertEquals('http://schemas.google.com/apps/2006#emailList.recipients', $emailListEntry->getFeedLink('http://schemas.google.com/apps/2006#emailList.recipients')->rel);
+ $this->assertEquals('http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/', $emailListEntry->getFeedLink('http://schemas.google.com/apps/2006#emailList.recipients')->href);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionElements() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionAttributes() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testEmptyEmailListEntryToAndFromStringShouldMatch() {
+ $entryXml = $this->entry->saveXML();
+ $newEmailListEntry = new Zend_Gdata_Gapps_EmailListEntry();
+ $newEmailListEntry->transferFromXML($entryXml);
+ $newEmailListEntryXml = $newEmailListEntry->saveXML();
+ $this->assertTrue($entryXml == $newEmailListEntryXml);
+ }
+
+ public function testGetFeedLinkReturnsAllStoredEntriesWhenUsedWithNoParameters() {
+ // Prepare test data
+ $entry1 = new Zend_Gdata_Extension_FeedLink();
+ $entry1->rel = "first";
+ $entry1->href= "foo";
+ $entry2 = new Zend_Gdata_Extension_FeedLink();
+ $entry2->rel = "second";
+ $entry2->href= "bar";
+ $data = array($entry1, $entry2);
+
+ // Load test data and run test
+ $this->entry->feedLink = $data;
+ $this->assertEquals(2, count($this->entry->feedLink));
+ }
+
+ public function testGetFeedLinkCanReturnEntriesByRelValue() {
+ // Prepare test data
+ $entry1 = new Zend_Gdata_Extension_FeedLink();
+ $entry1->rel = "first";
+ $entry1->href= "foo";
+ $entry2 = new Zend_Gdata_Extension_FeedLink();
+ $entry2->rel = "second";
+ $entry2->href= "bar";
+ $data = array($entry1, $entry2);
+
+ // Load test data and run test
+ $this->entry->feedLink = $data;
+ $this->assertEquals($entry1, $this->entry->getFeedLink('first'));
+ $this->assertEquals($entry2, $this->entry->getFeedLink('second'));
+ }
+
+ public function testSamplePropertiesAreCorrect () {
+ $this->entry->transferFromXML($this->entryText);
+ $this->verifyAllSamplePropertiesAreCorrect($this->entry);
+ }
+
+ public function testConvertEmailListEntryToAndFromString() {
+ $this->entry->transferFromXML($this->entryText);
+ $entryXml = $this->entry->saveXML();
+ $newEmailListEntry = new Zend_Gdata_Gapps_EmailListEntry();
+ $newEmailListEntry->transferFromXML($entryXml);
+ $this->verifyAllSamplePropertiesAreCorrect($newEmailListEntry);
+ $newEmailListEntryXml = $newEmailListEntry->saveXML();
+ $this->assertEquals($entryXml, $newEmailListEntryXml);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/EmailListFeedTest.php b/zend/tests/Zend/Gdata/Gapps/EmailListFeedTest.php
new file mode 100644
index 0000000..bcacfe8
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/EmailListFeedTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/EmailListFeed.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_EmailListFeedTest extends PHPUnit_Framework_TestCase
+{
+ protected $emailListFeed = null;
+
+ /**
+ * Called before each test to setup any fixtures.
+ */
+ public function setUp()
+ {
+ $emailListFeedText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml',
+ true);
+ $this->emailListFeed = new Zend_Gdata_Gapps_EmailListFeed($emailListFeedText);
+ $this->emptyEmailListFeed = new Zend_Gdata_Gapps_EmailListFeed();
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emptyEmailListFeed->extensionElements));
+ $this->assertTrue(count($this->emptyEmailListFeed->extensionElements) == 0);
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emptyEmailListFeed->extensionAttributes));
+ $this->assertTrue(count($this->emptyEmailListFeed->extensionAttributes) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emailListFeed->extensionElements));
+ $this->assertTrue(count($this->emailListFeed->extensionElements) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emailListFeed->extensionAttributes));
+ $this->assertTrue(count($this->emailListFeed->extensionAttributes) == 0);
+ }
+
+ /**
+ * Convert sample feed to XML then back to objects. Ensure that
+ * all objects are instances of EventEntry and object count matches.
+ */
+ public function testXmlImportAndOutputAreNonDestructive()
+ {
+ $entryCount = 0;
+ foreach ($this->emailListFeed as $entry) {
+ $entryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListEntry);
+ }
+ $this->assertTrue($entryCount > 0);
+
+ /* Grab XML from $this->emailListFeed and convert back to objects */
+ $newEmailListFeed = new Zend_Gdata_Gapps_EmailListFeed(
+ $this->emailListFeed->saveXML());
+ $newEntryCount = 0;
+ foreach ($newEmailListFeed as $entry) {
+ $newEntryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListEntry);
+ }
+ $this->assertEquals($entryCount, $newEntryCount);
+ }
+
+ /**
+ * Ensure that there number of lsit feeds equals the number
+ * of calendars defined in the sample file.
+ */
+ public function testAllEntriesInFeedAreInstantiated()
+ {
+ //TODO feeds implementing ArrayAccess would be helpful here
+ $entryCount = 0;
+ foreach ($this->emailListFeed as $entry) {
+ $entryCount++;
+ }
+ $this->assertEquals(2, $entryCount);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/EmailListQueryTest.php b/zend/tests/Zend/Gdata/Gapps/EmailListQueryTest.php
new file mode 100644
index 0000000..a4337c1
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/EmailListQueryTest.php
@@ -0,0 +1,138 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/EmailListQuery.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_EmailListQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->query = new Zend_Gdata_Gapps_EmailListQuery();
+ }
+
+ // Test to make sure that URI generation works
+ public function testDefaultQueryURIGeneration()
+ {
+ $this->query->setDomain("foo.bar.invalid");
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/foo.bar.invalid/emailList/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the domain accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetQueryDomain()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->assertEquals("my.domain.com", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0",
+ $this->query->getQueryUrl());
+
+ $this->query->setDomain("hello.world.baz");
+ $this->assertEquals("hello.world.baz", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/emailList/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the emailListName accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetEmailListNameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setEmailListName("foo");
+ $this->assertEquals("foo", $this->query->getEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setEmailListName("bar");
+ $this->assertEquals("bar", $this->query->getEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/bar",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the recipient accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetRecipientProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setRecipient("bar@qux.com");
+ $this->assertEquals("bar@qux.com", $this->query->getRecipient());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0?recipient=bar%40qux.com",
+ $this->query->getQueryUrl());
+
+ $this->query->setRecipient(null);
+ $this->assertEquals(null, $this->query->getRecipient());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the startUsername accessor methods work and
+ // propagate to the query URI.
+ public function testCanSetStartEmailListNameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setStartEmailListName("foo");
+ $this->assertEquals("foo", $this->query->getStartEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0?startEmailListName=foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setStartEmailListName(null);
+ $this->assertEquals(null, $this->query->getStartEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that all parameters can be set simultaneously with no
+ // ill effects.
+ public function testCanSetAllParameters()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setEmailListName("foo");
+ $this->query->setRecipient("bar@qux.com");
+ $this->query->setStartEmailListName("wibble");
+ $this->assertEquals("foo", $this->query->getEmailListName());
+ $this->assertEquals("bar@qux.com", $this->query->getRecipient());
+ $this->assertEquals("wibble", $this->query->getStartEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo?recipient=bar%40qux.com&startEmailListName=wibble",
+ $this->query->getQueryUrl());
+
+ $this->query->setRecipient("baz@blah.com");
+ $this->query->setEmailListName("xyzzy");
+ $this->query->setStartEmailListName("woof");
+ $this->assertEquals("xyzzy", $this->query->getEmailListName());
+ $this->assertEquals("baz@blah.com", $this->query->getRecipient());
+ $this->assertEquals("woof", $this->query->getStartEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/xyzzy?recipient=baz%40blah.com&startEmailListName=woof",
+ $this->query->getQueryUrl());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php b/zend/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php
new file mode 100644
index 0000000..c0cd784
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php
@@ -0,0 +1,107 @@
+<?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_Gapps
+ * @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/Gapps/EmailListRecipientEntry.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_EmailListRecipientEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->entryText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml',
+ true);
+ $this->entry = new Zend_Gdata_Gapps_EmailListRecipientEntry();
+ }
+
+ private function verifyAllSamplePropertiesAreCorrect ($emailListRecipientEntry) {
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com',
+ $emailListRecipientEntry->id->text);
+ $this->assertEquals('1970-01-01T00:00:00.000Z', $emailListRecipientEntry->updated->text);
+ $this->assertEquals('http://schemas.google.com/g/2005#kind', $emailListRecipientEntry->category[0]->scheme);
+ $this->assertEquals('http://schemas.google.com/apps/2006#emailList.recipient', $emailListRecipientEntry->category[0]->term);
+ $this->assertEquals('text', $emailListRecipientEntry->title->type);
+ $this->assertEquals('SusanJones', $emailListRecipientEntry->title->text);;
+ $this->assertEquals('self', $emailListRecipientEntry->getLink('self')->rel);
+ $this->assertEquals('application/atom+xml', $emailListRecipientEntry->getLink('self')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com', $emailListRecipientEntry->getLink('self')->href);
+ $this->assertEquals('edit', $emailListRecipientEntry->getLink('edit')->rel);
+ $this->assertEquals('application/atom+xml', $emailListRecipientEntry->getLink('edit')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com', $emailListRecipientEntry->getLink('edit')->href);
+ $this->assertEquals('SusanJones@example.com', $emailListRecipientEntry->who->email);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionElements() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionAttributes() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testEmptyEmailListRecipientEntryToAndFromStringShouldMatch() {
+ $entryXml = $this->entry->saveXML();
+ $newEmailListRecipientEntry = new Zend_Gdata_Gapps_EmailListRecipientEntry();
+ $newEmailListRecipientEntry->transferFromXML($entryXml);
+ $newEmailListRecipientEntryXml = $newEmailListRecipientEntry->saveXML();
+ $this->assertTrue($entryXml == $newEmailListRecipientEntryXml);
+ }
+
+ public function testSamplePropertiesAreCorrect () {
+ $this->entry->transferFromXML($this->entryText);
+ $this->verifyAllSamplePropertiesAreCorrect($this->entry);
+ }
+
+ public function testConvertEmailListRecipientEntryToAndFromString() {
+ $this->entry->transferFromXML($this->entryText);
+ $entryXml = $this->entry->saveXML();
+ $newEmailListRecipientEntry = new Zend_Gdata_Gapps_EmailListRecipientEntry();
+ $newEmailListRecipientEntry->transferFromXML($entryXml);
+ $this->verifyAllSamplePropertiesAreCorrect($newEmailListRecipientEntry);
+ $newEmailListRecipientEntryXml = $newEmailListRecipientEntry->saveXML();
+ $this->assertEquals($entryXml, $newEmailListRecipientEntryXml);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php b/zend/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php
new file mode 100644
index 0000000..e60b267
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/EmailListRecipientFeed.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_EmailListRecipientFeedTest extends PHPUnit_Framework_TestCase
+{
+ protected $emailListRecipientFeed = null;
+
+ /**
+ * Called before each test to setup any fixtures.
+ */
+ public function setUp()
+ {
+ $emailListRecipientFeedText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml',
+ true);
+ $this->emailListRecipientFeed = new Zend_Gdata_Gapps_EmailListRecipientFeed($emailListRecipientFeedText);
+ $this->emptyEmailListRecipientFeed = new Zend_Gdata_Gapps_EmailListRecipientFeed();
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emptyEmailListRecipientFeed->extensionElements));
+ $this->assertTrue(count($this->emptyEmailListRecipientFeed->extensionElements) == 0);
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emptyEmailListRecipientFeed->extensionAttributes));
+ $this->assertTrue(count($this->emptyEmailListRecipientFeed->extensionAttributes) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emailListRecipientFeed->extensionElements));
+ $this->assertTrue(count($this->emailListRecipientFeed->extensionElements) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emailListRecipientFeed->extensionAttributes));
+ $this->assertTrue(count($this->emailListRecipientFeed->extensionAttributes) == 0);
+ }
+
+ /**
+ * Convert sample feed to XML then back to objects. Ensure that
+ * all objects are instances of EventEntry and object count matches.
+ */
+ public function testXmlImportAndOutputAreNonDestructive()
+ {
+ $entryCount = 0;
+ foreach ($this->emailListRecipientFeed as $entry) {
+ $entryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListRecipientEntry);
+ }
+ $this->assertTrue($entryCount > 0);
+
+ /* Grab XML from $this->emailListRecipientFeed and convert back to objects */
+ $newEmailListRecipientFeed = new Zend_Gdata_Gapps_EmailListRecipientFeed(
+ $this->emailListRecipientFeed->saveXML());
+ $newEntryCount = 0;
+ foreach ($newEmailListRecipientFeed as $entry) {
+ $newEntryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_EmailListRecipientEntry);
+ }
+ $this->assertEquals($entryCount, $newEntryCount);
+ }
+
+ /**
+ * Ensure that there number of lsit feeds equals the number
+ * of calendars defined in the sample file.
+ */
+ public function testAllEntriesInFeedAreInstantiated()
+ {
+ //TODO feeds implementing ArrayAccess would be helpful here
+ $entryCount = 0;
+ foreach ($this->emailListRecipientFeed as $entry) {
+ $entryCount++;
+ }
+ $this->assertEquals(2, $entryCount);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php b/zend/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php
new file mode 100644
index 0000000..18d4e89
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php
@@ -0,0 +1,90 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/EmailListRecipientQuery.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_EmailListRecipientQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->query = new Zend_Gdata_Gapps_EmailListRecipientQuery();
+ }
+
+ // Test to make sure that the domain accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetQueryDomain()
+ {
+ $this->query->setEmailListName("something");
+ $this->query->setDomain("my.domain.com");
+ $this->assertEquals("my.domain.com", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/something/recipient/",
+ $this->query->getQueryUrl());
+
+ $this->query->setDomain("hello.world.baz");
+ $this->assertEquals("hello.world.baz", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/emailList/2.0/something/recipient/",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the emailListName accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetEmailListNameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setEmailListName("foo");
+ $this->assertEquals("foo", $this->query->getEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/",
+ $this->query->getQueryUrl());
+
+ $this->query->setEmailListName("bar");
+ $this->assertEquals("bar", $this->query->getEmailListName());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/bar/recipient/",
+ $this->query->getQueryUrl());
+ }
+
+ public function testCanSetStartRecipientProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setEmailListName("foo");
+ $this->query->setStartRecipient("bar");
+ $this->assertEquals("bar", $this->query->getStartRecipient());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/?startRecipient=bar",
+ $this->query->getQueryUrl());
+
+ $this->query->setStartRecipient(null);
+ $this->assertEquals(null, $this->query->getStartRecipient());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/emailList/2.0/foo/recipient/",
+ $this->query->getQueryUrl());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/EmailListTest.php b/zend/tests/Zend/Gdata/Gapps/EmailListTest.php
new file mode 100644
index 0000000..d404d82
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/EmailListTest.php
@@ -0,0 +1,126 @@
+<?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_Gapps
+ * @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/Gapps/Extension/EmailList.php';
+require_once 'Zend/Gdata.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_EmailListTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->emailListText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/EmailListElementSample1.xml',
+ true);
+ $this->emailList = new Zend_Gdata_Gapps_Extension_EmailList();
+ }
+
+ public function testEmptyEmailListShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emailList->extensionElements));
+ $this->assertTrue(count($this->emailList->extensionElements) == 0);
+ }
+
+ public function testEmptyEmailListShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emailList->extensionAttributes));
+ $this->assertTrue(count($this->emailList->extensionAttributes) == 0);
+ }
+
+ public function testSampleEmailListShouldHaveNoExtensionElements() {
+ $this->emailList->transferFromXML($this->emailListText);
+ $this->assertTrue(is_array($this->emailList->extensionElements));
+ $this->assertTrue(count($this->emailList->extensionElements) == 0);
+ }
+
+ public function testSampleEmailListShouldHaveNoExtensionAttributes() {
+ $this->emailList->transferFromXML($this->emailListText);
+ $this->assertTrue(is_array($this->emailList->extensionAttributes));
+ $this->assertTrue(count($this->emailList->extensionAttributes) == 0);
+ }
+
+ public function testNormalEmailListShouldHaveNoExtensionElements() {
+ $this->emailList->name = "test-name";
+
+ $this->assertEquals("test-name", $this->emailList->name);
+
+ $this->assertEquals(0, count($this->emailList->extensionElements));
+ $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList();
+ $newEmailList->transferFromXML($this->emailList->saveXML());
+ $this->assertEquals(0, count($newEmailList->extensionElements));
+ $newEmailList->extensionElements = array(
+ new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
+ $this->assertEquals(1, count($newEmailList->extensionElements));
+ $this->assertEquals("test-name", $newEmailList->name);
+
+ /* try constructing using magic factory */
+ $gdata = new Zend_Gdata_Gapps();
+ $newEmailList2 = $gdata->newEmailList();
+ $newEmailList2->transferFromXML($newEmailList->saveXML());
+ $this->assertEquals(1, count($newEmailList2->extensionElements));
+ $this->assertEquals("test-name", $newEmailList2->name);
+ }
+
+ public function testEmptyEmailListToAndFromStringShouldMatch() {
+ $emailListXml = $this->emailList->saveXML();
+ $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList();
+ $newEmailList->transferFromXML($emailListXml);
+ $newEmailListXml = $newEmailList->saveXML();
+ $this->assertTrue($emailListXml == $newEmailListXml);
+ }
+
+ public function testEmailListWithValueToAndFromStringShouldMatch() {
+ $this->emailList->name = "test-name";
+ $emailListXml = $this->emailList->saveXML();
+ $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList();
+ $newEmailList->transferFromXML($emailListXml);
+ $newEmailListXml = $newEmailList->saveXML();
+ $this->assertTrue($emailListXml == $newEmailListXml);
+ $this->assertEquals("test-name", $this->emailList->name);
+ }
+
+ public function testExtensionAttributes() {
+ $extensionAttributes = $this->emailList->extensionAttributes;
+ $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar');
+ $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab');
+ $this->emailList->extensionAttributes = $extensionAttributes;
+ $this->assertEquals('bar', $this->emailList->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $this->emailList->extensionAttributes['foo2']['value']);
+ $emailListXml = $this->emailList->saveXML();
+ $newEmailList = new Zend_Gdata_Gapps_Extension_EmailList();
+ $newEmailList->transferFromXML($emailListXml);
+ $this->assertEquals('bar', $newEmailList->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $newEmailList->extensionAttributes['foo2']['value']);
+ }
+
+ public function testConvertFullEmailListToAndFromString() {
+ $this->emailList->transferFromXML($this->emailListText);
+ $this->assertEquals("us-sales", $this->emailList->name);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/ErrorTest.php b/zend/tests/Zend/Gdata/Gapps/ErrorTest.php
new file mode 100644
index 0000000..9985d5e
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/ErrorTest.php
@@ -0,0 +1,88 @@
+<?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_Gapps
+ * @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/Gapps/Error.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_ErrorTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->error = new Zend_Gdata_Gapps_Error();
+ }
+
+ public function testCanSetAndGetErrorCodeUsingConstant() {
+ $this->error->setErrorCode(
+ Zend_Gdata_Gapps_Error::INVALID_EMAIL_ADDRESS);
+ $this->assertEquals(Zend_Gdata_Gapps_Error::INVALID_EMAIL_ADDRESS,
+ $this->error->getErrorCode());
+ }
+
+ public function testCanSetAndGetErrorCodeUsingInteger() {
+ $this->error->setErrorCode(123);
+ $this->assertEquals(123, $this->error->getErrorCode());
+ }
+
+ public function testCanSetAndGetReason() {
+ $text = "The foo is missing a bar.";
+ $this->error->setReason($text);
+ $this->assertEquals($text, $this->error->getReason());
+ }
+
+ public function testCanSetAndGetInvalidInput() {
+ $text = "for___baz";
+ $this->error->setInvalidInput($text);
+ $this->assertEquals($text, $this->error->getInvalidInput());
+ }
+
+ public function testContstructorAllowsSettingAllVariables() {
+ $this->error = new Zend_Gdata_Gapps_Error(
+ Zend_Gdata_Gapps_Error::USER_DELETED_RECENTLY,
+ "foo", "bar");
+ $this->assertEquals(Zend_Gdata_Gapps_Error::USER_DELETED_RECENTLY,
+ $this->error->getErrorCode());
+ $this->assertEquals("foo", $this->error->getReason());
+ $this->assertEquals("bar", $this->error->getInvalidInput());
+ }
+
+ public function testToStringProvidesHelpfulMessage() {
+ $this->error->setErrorCode(Zend_Gdata_Gapps_Error::USER_SUSPENDED);
+ $this->error->setReason("The foo is missing a bar.");
+ $this->error->setInvalidInput("for___baz");
+ $this->assertEquals("Error 1101: The foo is missing a bar.\n\tInvalid Input: \"for___baz\"", $this->error->__toString());
+
+ $this->error->setErrorCode(Zend_Gdata_Gapps_Error::UNKNOWN_ERROR);
+ $this->error->setReason("Unknown error.");
+ $this->error->setInvalidInput("blah");
+ $this->assertEquals("Error 1000: Unknown error.\n\tInvalid Input: \"blah\"", $this->error->__toString());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/GroupEntryTest.php b/zend/tests/Zend/Gdata/Gapps/GroupEntryTest.php
new file mode 100644
index 0000000..ad8876f
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/GroupEntryTest.php
@@ -0,0 +1,110 @@
+<?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_Gapps
+ * @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/Gapps/GroupEntry.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_GroupEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->entryText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml',
+ true);
+ $this->entry = new Zend_Gdata_Gapps_GroupEntry();
+ }
+
+ private function verifyAllSamplePropertiesAreCorrect ($groupEntry) {
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales',
+ $groupEntry->id->text);
+ $this->assertEquals('1970-01-01T00:00:00.000Z', $groupEntry->updated->text);
+ $this->assertEquals('self', $groupEntry->getLink('self')->rel);
+ $this->assertEquals('application/atom+xml', $groupEntry->getLink('self')->type);
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales', $groupEntry->getLink('self')->href);
+ $this->assertEquals('edit', $groupEntry->getLink('edit')->rel);
+ $this->assertEquals('application/atom+xml', $groupEntry->getLink('edit')->type);
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales', $groupEntry->getLink('edit')->href);
+ $this->assertEquals('groupId', $groupEntry->property[0]->name);
+ $this->assertEquals('us-sales', $groupEntry->property[0]->value);
+ $this->assertEquals('groupName', $groupEntry->property[1]->name);
+ $this->assertEquals('us-sales', $groupEntry->property[1]->value);
+ $this->assertEquals('description', $groupEntry->property[2]->name);
+ $this->assertEquals('UnitedStatesSalesTeam', $groupEntry->property[2]->value);
+ $this->assertEquals('emailPermission', $groupEntry->property[3]->name);
+ $this->assertEquals('Domain', $groupEntry->property[3]->value);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionElements() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionAttributes() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testEmptyGroupEntryToAndFromStringShouldMatch() {
+ $entryXml = $this->entry->saveXML();
+ $newGroupEntry = new Zend_Gdata_Gapps_GroupEntry();
+ $newGroupEntry->transferFromXML($entryXml);
+ $newGroupEntryXml = $newGroupEntry->saveXML();
+ $this->assertTrue($entryXml == $newGroupEntryXml);
+ }
+
+ public function testSamplePropertiesAreCorrect () {
+ $this->entry->transferFromXML($this->entryText);
+ $this->verifyAllSamplePropertiesAreCorrect($this->entry);
+ }
+
+ public function testConvertGroupEntryToAndFromString() {
+ $this->entry->transferFromXML($this->entryText);
+ $entryXml = $this->entry->saveXML();
+ $newGroupEntry = new Zend_Gdata_Gapps_GroupEntry();
+ $newGroupEntry->transferFromXML($entryXml);
+ $this->verifyAllSamplePropertiesAreCorrect($newGroupEntry);
+ $newGroupEntryXml = $newGroupEntry->saveXML();
+ $this->assertEquals($entryXml, $newGroupEntryXml);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/GroupFeedTest.php b/zend/tests/Zend/Gdata/Gapps/GroupFeedTest.php
new file mode 100644
index 0000000..0bbbf19
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/GroupFeedTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/GroupFeed.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_GroupFeedTest extends PHPUnit_Framework_TestCase
+{
+ protected $groupFeed = null;
+
+ /**
+ * Called before each test to setup any fixtures.
+ */
+ public function setUp()
+ {
+ $groupFeedText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml',
+ true);
+ $this->groupFeed = new Zend_Gdata_Gapps_GroupFeed($groupFeedText);
+ $this->emptyGroupFeed = new Zend_Gdata_Gapps_GroupFeed();
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emptyGroupFeed->extensionElements));
+ $this->assertTrue(count($this->emptyGroupFeed->extensionElements) == 0);
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emptyGroupFeed->extensionAttributes));
+ $this->assertTrue(count($this->emptyGroupFeed->extensionAttributes) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->groupFeed->extensionElements));
+ $this->assertTrue(count($this->groupFeed->extensionElements) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->groupFeed->extensionAttributes));
+ $this->assertTrue(count($this->groupFeed->extensionAttributes) == 0);
+ }
+
+ /**
+ * Convert sample feed to XML then back to objects. Ensure that
+ * all objects are instances of GroupEntry and object count matches.
+ */
+ public function testXmlImportAndOutputAreNonDestructive()
+ {
+ $entryCount = 0;
+ foreach ($this->groupFeed as $entry) {
+ $entryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_GroupEntry);
+ }
+ $this->assertTrue($entryCount > 0);
+
+ /* Grab XML from $this->groupFeed and convert back to objects */
+ $newGroupFeed = new Zend_Gdata_Gapps_GroupFeed(
+ $this->groupFeed->saveXML());
+ $newEntryCount = 0;
+ foreach ($newGroupFeed as $entry) {
+ $newEntryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_GroupEntry);
+ }
+ $this->assertEquals($entryCount, $newEntryCount);
+ }
+
+ /**
+ * Ensure that there number of group entries equals the number
+ * of groups defined in the sample file.
+ */
+ public function testAllEntriesInFeedAreInstantiated()
+ {
+ //TODO feeds implementing ArrayAccess would be helpful here
+ $entryCount = 0;
+ foreach ($this->groupFeed as $entry) {
+ $entryCount++;
+ }
+ $this->assertEquals(2, $entryCount);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/GroupQueryTest.php b/zend/tests/Zend/Gdata/Gapps/GroupQueryTest.php
new file mode 100644
index 0000000..c613e8d
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/GroupQueryTest.php
@@ -0,0 +1,168 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/GroupQuery.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_GroupQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->query = new Zend_Gdata_Gapps_GroupQuery();
+ }
+
+ // Test to make sure that URI generation works
+ public function testDefaultQueryURIGeneration()
+ {
+ $this->query->setDomain("foo.bar.invalid");
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/foo.bar.invalid",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the domain accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetQueryDomain()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->assertEquals("my.domain.com", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com",
+ $this->query->getQueryUrl());
+
+ $this->query->setDomain("hello.world.baz");
+ $this->assertEquals("hello.world.baz", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/hello.world.baz",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the groupId accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetGroupIdProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setGroupId("foo");
+ $this->assertEquals("foo", $this->query->getGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setGroupId("bar");
+ $this->assertEquals("bar", $this->query->getGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/bar",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the member accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetMemberProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setMember("bar@qux.com");
+ $this->assertEquals("bar@qux.com", $this->query->getMember());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/?member=bar%40qux.com",
+ $this->query->getQueryUrl());
+
+ $this->query->setMember(null);
+ $this->assertEquals(null, $this->query->getMember());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the startUsername accessor methods work and
+ // propagate to the query URI.
+ public function testCanSetStartGroupIdProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setStartGroupId("foo");
+ $this->assertEquals("foo", $this->query->getStartGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com?start=foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setStartGroupId(null);
+ $this->assertEquals(null, $this->query->getStartGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com",
+ $this->query->getQueryUrl());
+ }
+
+ public function testCanSetDirectOnlyProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setMember("bar@qux.com");
+ $this->query->setDirectOnly(true);
+ $this->assertEquals(true, $this->query->getDirectOnly());
+ $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/";
+ $expected_url .= "?member=bar%40qux.com&directOnly=true";
+ $this->assertEquals($expected_url, $this->query->getQueryUrl());
+
+ $this->query->setDirectOnly(false);
+ $this->assertEquals(false, $this->query->getDirectOnly());
+ $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/";
+ $expected_url .= "?member=bar%40qux.com&directOnly=false";
+ $this->assertEquals($expected_url, $this->query->getQueryUrl());
+
+ $this->query->setDirectOnly(null);
+ $this->assertEquals(null, $this->query->getDirectOnly());
+ $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/";
+ $expected_url .= "?member=bar%40qux.com";
+ $this->assertEquals($expected_url, $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that all parameters can be set simultaneously with no
+ // ill effects.
+ public function testCanSetAllParameters()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setGroupId("foo");
+ $this->query->setMember("bar@qux.com");
+ $this->query->setStartGroupId("wibble");
+ $this->query->setDirectOnly(true);
+ $this->assertEquals("foo", $this->query->getGroupId());
+ $this->assertEquals("bar@qux.com", $this->query->getMember());
+ $this->assertEquals("wibble", $this->query->getStartGroupId());
+ $this->assertEquals(true, $this->query->getDirectOnly());
+ $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/";
+ $expected_url .= "foo/?member=bar%40qux.com&start=wibble&directOnly=true";
+ $this->assertEquals($expected_url, $this->query->getQueryUrl());
+
+ $this->query->setMember("baz@blah.com");
+ $this->query->setGroupId("xyzzy");
+ $this->query->setStartGroupId("woof");
+ $this->query->setDirectOnly(false);
+ $this->assertEquals("xyzzy", $this->query->getGroupId());
+ $this->assertEquals("baz@blah.com", $this->query->getMember());
+ $this->assertEquals("woof", $this->query->getStartGroupId());
+ $this->assertEquals(false, $this->query->getDirectOnly());
+ $expected_url = "https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/";
+ $expected_url .= "xyzzy/?member=baz%40blah.com&start=woof&directOnly=false";
+ $this->assertEquals($expected_url, $this->query->getQueryUrl());
+ }
+
+}
+
diff --git a/zend/tests/Zend/Gdata/Gapps/LoginTest.php b/zend/tests/Zend/Gdata/Gapps/LoginTest.php
new file mode 100644
index 0000000..4847427
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/LoginTest.php
@@ -0,0 +1,169 @@
+<?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_Gapps
+ * @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/Gapps/Extension/Login.php';
+require_once 'Zend/Gdata.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_LoginTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->loginText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/LoginElementSample1.xml',
+ true);
+ $this->login = new Zend_Gdata_Gapps_Extension_Login();
+ }
+
+ public function testEmptyLoginShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->login->extensionElements));
+ $this->assertTrue(count($this->login->extensionElements) == 0);
+ }
+
+ public function testEmptyLoginShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->login->extensionAttributes));
+ $this->assertTrue(count($this->login->extensionAttributes) == 0);
+ }
+
+ public function testSampleLoginShouldHaveNoExtensionElements() {
+ $this->login->transferFromXML($this->loginText);
+ $this->assertTrue(is_array($this->login->extensionElements));
+ $this->assertTrue(count($this->login->extensionElements) == 0);
+ }
+
+ public function testSampleLoginShouldHaveNoExtensionAttributes() {
+ $this->login->transferFromXML($this->loginText);
+ $this->assertTrue(is_array($this->login->extensionAttributes));
+ $this->assertTrue(count($this->login->extensionAttributes) == 0);
+ }
+
+ public function testNormalLoginShouldHaveNoExtensionElements() {
+ $this->login->username = "johndoe";
+ $this->login->password = "abcdefg1234567890";
+ $this->login->hashFunctionName = "Foo";
+ $this->login->suspended = true;
+ $this->login->admin = true;
+ $this->login->changePasswordAtNextLogin = true;
+ $this->login->agreedToTerms = false;
+
+ $this->assertEquals("johndoe", $this->login->username);
+ $this->assertEquals("abcdefg1234567890", $this->login->password);
+ $this->assertEquals("Foo", $this->login->hashFunctionName);
+ $this->assertEquals(true, $this->login->suspended);
+ $this->assertEquals(true, $this->login->admin);
+ $this->assertEquals(true, $this->login->changePasswordAtNextLogin);
+ $this->assertEquals(false, $this->login->agreedToTerms);
+
+ $this->assertEquals(0, count($this->login->extensionElements));
+ $newLogin = new Zend_Gdata_Gapps_Extension_Login();
+ $newLogin->transferFromXML($this->login->saveXML());
+ $this->assertEquals(0, count($newLogin->extensionElements));
+ $newLogin->extensionElements = array(
+ new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
+ $this->assertEquals(1, count($newLogin->extensionElements));
+ $this->assertEquals("johndoe", $newLogin->username);
+ $this->assertEquals("abcdefg1234567890", $newLogin->password);
+ $this->assertEquals("Foo", $newLogin->hashFunctionName);
+ $this->assertEquals(true, $newLogin->suspended);
+ $this->assertEquals(true, $newLogin->admin);
+ $this->assertEquals(true, $newLogin->changePasswordAtNextLogin);
+ $this->assertEquals(false, $newLogin->agreedToTerms);
+
+ /* try constructing using magic factory */
+ $gdata = new Zend_Gdata_Gapps();
+ $newLogin2 = $gdata->newLogin();
+ $newLogin2->transferFromXML($newLogin->saveXML());
+ $this->assertEquals(1, count($newLogin2->extensionElements));
+ $this->assertEquals("johndoe", $newLogin2->username);
+ $this->assertEquals("abcdefg1234567890", $newLogin2->password);
+ $this->assertEquals("Foo", $newLogin2->hashFunctionName);
+ $this->assertEquals(true, $newLogin2->suspended);
+ $this->assertEquals(true, $newLogin2->admin);
+ $this->assertEquals(true, $newLogin2->changePasswordAtNextLogin);
+ $this->assertEquals(false, $newLogin2->agreedToTerms);
+ }
+
+ public function testEmptyLoginToAndFromStringShouldMatch() {
+ $loginXml = $this->login->saveXML();
+ $newLogin = new Zend_Gdata_Gapps_Extension_Login();
+ $newLogin->transferFromXML($loginXml);
+ $newLoginXml = $newLogin->saveXML();
+ $this->assertTrue($loginXml == $newLoginXml);
+ }
+
+ public function testLoginWithValueToAndFromStringShouldMatch() {
+ $this->login->username = "johndoe";
+ $this->login->password = "abcdefg1234567890";
+ $this->login->hashFunctionName = "Foo";
+ $this->login->suspended = true;
+ $this->login->admin = true;
+ $this->login->changePasswordAtNextLogin = true;
+ $this->login->agreedToTerms = false;
+ $loginXml = $this->login->saveXML();
+ $newLogin = new Zend_Gdata_Gapps_Extension_Login();
+ $newLogin->transferFromXML($loginXml);
+ $newLoginXml = $newLogin->saveXML();
+ $this->assertTrue($loginXml == $newLoginXml);
+ $this->assertEquals("johndoe", $this->login->username);
+ $this->assertEquals("abcdefg1234567890", $this->login->password);
+ $this->assertEquals("Foo", $this->login->hashFunctionName);
+ $this->assertEquals(true, $this->login->suspended);
+ $this->assertEquals(true, $this->login->admin);
+ $this->assertEquals(true, $this->login->changePasswordAtNextLogin);
+ $this->assertEquals(false, $this->login->agreedToTerms);
+
+ }
+
+ public function testExtensionAttributes() {
+ $extensionAttributes = $this->login->extensionAttributes;
+ $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar');
+ $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab');
+ $this->login->extensionAttributes = $extensionAttributes;
+ $this->assertEquals('bar', $this->login->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $this->login->extensionAttributes['foo2']['value']);
+ $loginXml = $this->login->saveXML();
+ $newLogin = new Zend_Gdata_Gapps_Extension_Login();
+ $newLogin->transferFromXML($loginXml);
+ $this->assertEquals('bar', $newLogin->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $newLogin->extensionAttributes['foo2']['value']);
+ }
+
+ public function testConvertFullLoginToAndFromString() {
+ $this->login->transferFromXML($this->loginText);
+ $this->assertEquals("SusanJones-1321", $this->login->username);
+ $this->assertEquals("123\$\$abc", $this->login->password);
+ $this->assertEquals("SHA-1", $this->login->hashFunctionName);
+ $this->assertEquals(false, $this->login->suspended);
+ $this->assertEquals(false, $this->login->admin);
+ $this->assertEquals(false, $this->login->changePasswordAtNextLogin);
+ $this->assertEquals(true, $this->login->agreedToTerms);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/MemberEntryTest.php b/zend/tests/Zend/Gdata/Gapps/MemberEntryTest.php
new file mode 100644
index 0000000..f428792
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/MemberEntryTest.php
@@ -0,0 +1,108 @@
+<?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_Gapps
+ * @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/Gapps/MemberEntry.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_MemberEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->entryText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml',
+ true);
+ $this->entry = new Zend_Gdata_Gapps_MemberEntry();
+ }
+
+ private function verifyAllSamplePropertiesAreCorrect ($memberEntry) {
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com',
+ $memberEntry->id->text);
+ $this->assertEquals('1970-01-01T00:00:00.000Z', $memberEntry->updated->text);
+ $this->assertEquals('self', $memberEntry->getLink('self')->rel);
+ $this->assertEquals('application/atom+xml', $memberEntry->getLink('self')->type);
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com', $memberEntry->getLink('self')->href);
+ $this->assertEquals('edit', $memberEntry->getLink('edit')->rel);
+ $this->assertEquals('application/atom+xml', $memberEntry->getLink('edit')->type);
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com', $memberEntry->getLink('edit')->href);
+ $this->assertEquals('memberId', $memberEntry->property[0]->name);
+ $this->assertEquals('suejones@example.com', $memberEntry->property[0]->value);
+ $this->assertEquals('memberType', $memberEntry->property[1]->name);
+ $this->assertEquals('User', $memberEntry->property[1]->value);
+ $this->assertEquals('directMember', $memberEntry->property[2]->name);
+ $this->assertEquals('true', $memberEntry->property[2]->value);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionElements() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionAttributes() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testEmptyMemberEntryToAndFromStringShouldMatch() {
+ $entryXml = $this->entry->saveXML();
+ $newMemberEntry = new Zend_Gdata_Gapps_MemberEntry();
+ $newMemberEntry->transferFromXML($entryXml);
+ $newMemberEntryXml = $newMemberEntry->saveXML();
+ $this->assertTrue($entryXml == $newMemberEntryXml);
+ }
+
+ public function testSamplePropertiesAreCorrect () {
+ $this->entry->transferFromXML($this->entryText);
+ $this->verifyAllSamplePropertiesAreCorrect($this->entry);
+ }
+
+ public function testConvertMemberEntryToAndFromString() {
+ $this->entry->transferFromXML($this->entryText);
+ $entryXml = $this->entry->saveXML();
+ $newMemberEntry = new Zend_Gdata_Gapps_MemberEntry();
+ $newMemberEntry->transferFromXML($entryXml);
+ $this->verifyAllSamplePropertiesAreCorrect($newMemberEntry);
+ $newMemberEntryXml = $newMemberEntry->saveXML();
+ $this->assertEquals($entryXml, $newMemberEntryXml);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/MemberFeedTest.php b/zend/tests/Zend/Gdata/Gapps/MemberFeedTest.php
new file mode 100644
index 0000000..cb43cfe
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/MemberFeedTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/MemberFeed.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_MemberFeedTest extends PHPUnit_Framework_TestCase
+{
+ protected $memberFeed = null;
+
+ /**
+ * Called before each test to setup any fixtures.
+ */
+ public function setUp()
+ {
+ $memberFeedText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml',
+ true);
+ $this->memberFeed = new Zend_Gdata_Gapps_MemberFeed($memberFeedText);
+ $this->emptyMemberFeed = new Zend_Gdata_Gapps_MemberFeed();
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emptyMemberFeed->extensionElements));
+ $this->assertTrue(count($this->emptyMemberFeed->extensionElements) == 0);
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emptyMemberFeed->extensionAttributes));
+ $this->assertTrue(count($this->emptyMemberFeed->extensionAttributes) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->memberFeed->extensionElements));
+ $this->assertTrue(count($this->memberFeed->extensionElements) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->memberFeed->extensionAttributes));
+ $this->assertTrue(count($this->memberFeed->extensionAttributes) == 0);
+ }
+
+ /**
+ * Convert sample feed to XML then back to objects. Ensure that
+ * all objects are instances of MemberEntry and object count matches.
+ */
+ public function testXmlImportAndOutputAreNonDestructive()
+ {
+ $entryCount = 0;
+ foreach ($this->memberFeed as $entry) {
+ $entryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_MemberEntry);
+ }
+ $this->assertTrue($entryCount > 0);
+
+ /* Grab XML from $this->memberFeed and convert back to objects */
+ $newMemberFeed = new Zend_Gdata_Gapps_MemberFeed(
+ $this->memberFeed->saveXML());
+ $newEntryCount = 0;
+ foreach ($newMemberFeed as $entry) {
+ $newEntryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_MemberEntry);
+ }
+ $this->assertEquals($entryCount, $newEntryCount);
+ }
+
+ /**
+ * Ensure that there number of member entries equals the number
+ * of members defined in the sample file.
+ */
+ public function testAllEntriesInFeedAreInstantiated()
+ {
+ //TODO feeds implementing ArrayAccess would be helpful here
+ $entryCount = 0;
+ foreach ($this->memberFeed as $entry) {
+ $entryCount++;
+ }
+ $this->assertEquals(2, $entryCount);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/MemberQueryTest.php b/zend/tests/Zend/Gdata/Gapps/MemberQueryTest.php
new file mode 100644
index 0000000..e7fc2b9
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/MemberQueryTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/MemberQuery.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_MemberQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->query = new Zend_Gdata_Gapps_MemberQuery();
+ }
+
+ // Test to make sure that the domain accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetQueryDomain()
+ {
+ $this->query->setGroupId("something");
+ $this->query->setDomain("my.domain.com");
+ $this->assertEquals("my.domain.com", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/something/member",
+ $this->query->getQueryUrl());
+
+ $this->query->setDomain("hello.world.baz");
+ $this->assertEquals("hello.world.baz", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/hello.world.baz/something/member",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the groupId accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetGroupIdProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setGroupId("foo");
+ $this->assertEquals("foo", $this->query->getGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member",
+ $this->query->getQueryUrl());
+
+ $this->query->setGroupId("bar");
+ $this->assertEquals("bar", $this->query->getGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/bar/member",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the memberId accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetMemberIdProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setGroupId("foo");
+ $this->query->setMemberId("bar");
+ $this->assertEquals("bar", $this->query->getMemberId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member/bar",
+ $this->query->getQueryUrl());
+
+ $this->query->setGroupId("baz");
+ $this->query->setMemberId(null);
+ $this->assertEquals(null, $this->query->getMemberId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/baz/member",
+ $this->query->getQueryUrl());
+ }
+
+ public function testCanSetStartMemberIdProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setGroupId("foo");
+ $this->query->setStartMemberId("bar");
+ $this->assertEquals("bar", $this->query->getStartMemberId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member?start=bar",
+ $this->query->getQueryUrl());
+
+ $this->query->setStartMemberId(null);
+ $this->assertEquals(null, $this->query->getStartMemberId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/member",
+ $this->query->getQueryUrl());
+ }
+
+}
+
diff --git a/zend/tests/Zend/Gdata/Gapps/NameTest.php b/zend/tests/Zend/Gdata/Gapps/NameTest.php
new file mode 100644
index 0000000..9c0ca3b
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/NameTest.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_Gapps
+ * @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/Gapps/Extension/Name.php';
+require_once 'Zend/Gdata.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_NameTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->theNameText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/NameElementSample1.xml',
+ true);
+ $this->theName = new Zend_Gdata_Gapps_Extension_Name();
+ }
+
+ public function testEmptyNameShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->theName->extensionElements));
+ $this->assertTrue(count($this->theName->extensionElements) == 0);
+ }
+
+ public function testEmptyNameShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->theName->extensionAttributes));
+ $this->assertTrue(count($this->theName->extensionAttributes) == 0);
+ }
+
+ public function testSampleNameShouldHaveNoExtensionElements() {
+ $this->theName->transferFromXML($this->theNameText);
+ $this->assertTrue(is_array($this->theName->extensionElements));
+ $this->assertTrue(count($this->theName->extensionElements) == 0);
+ }
+
+ public function testSampleNameShouldHaveNoExtensionAttributes() {
+ $this->theName->transferFromXML($this->theNameText);
+ $this->assertTrue(is_array($this->theName->extensionAttributes));
+ $this->assertTrue(count($this->theName->extensionAttributes) == 0);
+ }
+
+ public function testNormalNameShouldHaveNoExtensionElements() {
+ $this->theName->givenName = "John";
+ $this->theName->familyName = "Doe";
+
+ $this->assertEquals("John", $this->theName->givenName);
+ $this->assertEquals("Doe", $this->theName->familyName);
+
+ $this->assertEquals(0, count($this->theName->extensionElements));
+ $newName = new Zend_Gdata_Gapps_Extension_Name();
+ $newName->transferFromXML($this->theName->saveXML());
+ $this->assertEquals(0, count($newName->extensionElements));
+ $newName->extensionElements = array(
+ new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
+ $this->assertEquals(1, count($newName->extensionElements));
+ $this->assertEquals("John", $newName->givenName);
+ $this->assertEquals("Doe", $newName->familyName);
+
+ /* try constructing using magic factory */
+ $gdata = new Zend_Gdata_Gapps();
+ $newName2 = $gdata->newName();
+ $newName2->transferFromXML($newName->saveXML());
+ $this->assertEquals(1, count($newName2->extensionElements));
+ $this->assertEquals("John", $newName2->givenName);
+ $this->assertEquals("Doe", $newName2->familyName);
+ }
+
+ public function testEmptyNameToAndFromStringShouldMatch() {
+ $nameXml = $this->theName->saveXML();
+ $newName = new Zend_Gdata_Gapps_Extension_Name();
+ $newName->transferFromXML($nameXml);
+ $newNameXml = $newName->saveXML();
+ $this->assertTrue($nameXml == $newNameXml);
+ }
+
+ public function testNameWithValueToAndFromStringShouldMatch() {
+ $this->theName->givenName = "John";
+ $this->theName->familyName = "Doe";
+ $nameXml = $this->theName->saveXML();
+ $newName = new Zend_Gdata_Gapps_Extension_Name();
+ $newName->transferFromXML($nameXml);
+ $newNameXml = $newName->saveXML();
+ $this->assertTrue($nameXml == $newNameXml);
+ $this->assertEquals("John", $this->theName->givenName);
+ $this->assertEquals("Doe", $this->theName->familyName);
+ }
+
+ public function testExtensionAttributes() {
+ $extensionAttributes = $this->theName->extensionAttributes;
+ $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar');
+ $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab');
+ $this->theName->extensionAttributes = $extensionAttributes;
+ $this->assertEquals('bar', $this->theName->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $this->theName->extensionAttributes['foo2']['value']);
+ $nameXml = $this->theName->saveXML();
+ $newName = new Zend_Gdata_Gapps_Extension_Name();
+ $newName->transferFromXML($nameXml);
+ $this->assertEquals('bar', $newName->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $newName->extensionAttributes['foo2']['value']);
+ }
+
+ public function testConvertFullNameToAndFromString() {
+ $this->theName->transferFromXML($this->theNameText);
+ $this->assertEquals("Susan", $this->theName->givenName);
+ $this->assertEquals("Jones", $this->theName->familyName);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/NicknameEntryTest.php b/zend/tests/Zend/Gdata/Gapps/NicknameEntryTest.php
new file mode 100644
index 0000000..e49ee25
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/NicknameEntryTest.php
@@ -0,0 +1,112 @@
+<?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_Gapps
+ * @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/Gapps/NicknameEntry.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_NicknameEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->entryText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml',
+ true);
+ $this->entry = new Zend_Gdata_Gapps_NicknameEntry();
+ }
+
+ private function verifyAllSamplePropertiesAreCorrect ($nicknameEntry) {
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy',
+ $nicknameEntry->id->text);
+ $this->assertEquals('1970-01-01T00:00:00.000Z', $nicknameEntry->updated->text);
+ $this->assertEquals('http://schemas.google.com/g/2005#kind', $nicknameEntry->category[0]->scheme);
+ $this->assertEquals('http://schemas.google.com/apps/2006#nickname', $nicknameEntry->category[0]->term);
+ $this->assertEquals('text', $nicknameEntry->title->type);
+ $this->assertEquals('Susy', $nicknameEntry->title->text);;
+ $this->assertEquals('self', $nicknameEntry->getLink('self')->rel);
+ $this->assertEquals('application/atom+xml', $nicknameEntry->getLink('self')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy', $nicknameEntry->getLink('self')->href);
+ $this->assertEquals('edit', $nicknameEntry->getLink('edit')->rel);
+ $this->assertEquals('application/atom+xml', $nicknameEntry->getLink('edit')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy', $nicknameEntry->getLink('edit')->href);
+ $this->assertEquals('Susy', $nicknameEntry->nickname->name);
+ $this->assertEquals('SusanJones', $nicknameEntry->login->username);
+ $this->assertEquals(false, $nicknameEntry->login->suspended);
+ $this->assertEquals(false, $nicknameEntry->login->admin);
+ $this->assertEquals(false, $nicknameEntry->login->changePasswordAtNextLogin);
+ $this->assertEquals(true, $nicknameEntry->login->agreedToTerms);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionElements() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionAttributes() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testEmptyNicknameEntryToAndFromStringShouldMatch() {
+ $entryXml = $this->entry->saveXML();
+ $newNicknameEntry = new Zend_Gdata_Gapps_NicknameEntry();
+ $newNicknameEntry->transferFromXML($entryXml);
+ $newNicknameEntryXml = $newNicknameEntry->saveXML();
+ $this->assertTrue($entryXml == $newNicknameEntryXml);
+ }
+
+ public function testSamplePropertiesAreCorrect () {
+ $this->entry->transferFromXML($this->entryText);
+ $this->verifyAllSamplePropertiesAreCorrect($this->entry);
+ }
+
+ public function testConvertNicknameEntryToAndFromString() {
+ $this->entry->transferFromXML($this->entryText);
+ $entryXml = $this->entry->saveXML();
+ $newNicknameEntry = new Zend_Gdata_Gapps_NicknameEntry();
+ $newNicknameEntry->transferFromXML($entryXml);
+ $this->verifyAllSamplePropertiesAreCorrect($newNicknameEntry);
+ $newNicknameEntryXml = $newNicknameEntry->saveXML();
+ $this->assertEquals($entryXml, $newNicknameEntryXml);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/NicknameFeedTest.php b/zend/tests/Zend/Gdata/Gapps/NicknameFeedTest.php
new file mode 100644
index 0000000..3bb9953
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/NicknameFeedTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/NicknameFeed.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_NicknameFeedTest extends PHPUnit_Framework_TestCase
+{
+ protected $nicknameFeed = null;
+
+ /**
+ * Called before each test to setup any fixtures.
+ */
+ public function setUp()
+ {
+ $nicknameFeedText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml',
+ true);
+ $this->nicknameFeed = new Zend_Gdata_Gapps_NicknameFeed($nicknameFeedText);
+ $this->emptyNicknameFeed = new Zend_Gdata_Gapps_NicknameFeed();
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emptyNicknameFeed->extensionElements));
+ $this->assertTrue(count($this->emptyNicknameFeed->extensionElements) == 0);
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emptyNicknameFeed->extensionAttributes));
+ $this->assertTrue(count($this->emptyNicknameFeed->extensionAttributes) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->nicknameFeed->extensionElements));
+ $this->assertTrue(count($this->nicknameFeed->extensionElements) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->nicknameFeed->extensionAttributes));
+ $this->assertTrue(count($this->nicknameFeed->extensionAttributes) == 0);
+ }
+
+ /**
+ * Convert sample feed to XML then back to objects. Ensure that
+ * all objects are instances of EventEntry and object count matches.
+ */
+ public function testXmlImportAndOutputAreNonDestructive()
+ {
+ $entryCount = 0;
+ foreach ($this->nicknameFeed as $entry) {
+ $entryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_NicknameEntry);
+ }
+ $this->assertTrue($entryCount > 0);
+
+ /* Grab XML from $this->nicknameFeed and convert back to objects */
+ $newNicknameFeed = new Zend_Gdata_Gapps_NicknameFeed(
+ $this->nicknameFeed->saveXML());
+ $newEntryCount = 0;
+ foreach ($newNicknameFeed as $entry) {
+ $newEntryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_NicknameEntry);
+ }
+ $this->assertEquals($entryCount, $newEntryCount);
+ }
+
+ /**
+ * Ensure that there number of lsit feeds equals the number
+ * of calendars defined in the sample file.
+ */
+ public function testAllEntriesInFeedAreInstantiated()
+ {
+ //TODO feeds implementing ArrayAccess would be helpful here
+ $entryCount = 0;
+ foreach ($this->nicknameFeed as $entry) {
+ $entryCount++;
+ }
+ $this->assertEquals(2, $entryCount);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/NicknameQueryTest.php b/zend/tests/Zend/Gdata/Gapps/NicknameQueryTest.php
new file mode 100644
index 0000000..2730c62
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/NicknameQueryTest.php
@@ -0,0 +1,140 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/NicknameQuery.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_NicknameQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->query = new Zend_Gdata_Gapps_NicknameQuery();
+ }
+
+ // Test to make sure that URI generation works
+ public function testDefaultQueryURIGeneration()
+ {
+ $this->query->setDomain("foo.bar.invalid");
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/foo.bar.invalid/nickname/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the domain accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetQueryDomain()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->assertEquals("my.domain.com", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0",
+ $this->query->getQueryUrl());
+
+ $this->query->setDomain("hello.world.baz");
+ $this->assertEquals("hello.world.baz", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/nickname/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the username accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetUsernameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setUsername("foo");
+ $this->assertEquals("foo", $this->query->getUsername());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0?username=foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setUsername(null);
+ $this->assertEquals(null, $this->query->getUsername());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the nickname accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetNicknameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setNickname("foo");
+ $this->assertEquals("foo", $this->query->getNickname());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setNickname("bar");
+ $this->assertEquals("bar", $this->query->getNickname());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/bar",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the startNickname accessor methods work and
+ // propagate to the query URI.
+ public function testCanSetStartNicknameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setNickname("foo");
+ $this->query->setStartNickname("bar");
+ $this->assertEquals("bar", $this->query->getStartNickname());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo?startNickname=bar",
+ $this->query->getQueryUrl());
+
+ $this->query->setStartNickname(null);
+ $this->assertEquals(null, $this->query->getStartNickname());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo",
+ $this->query->getQueryUrl());
+ }
+
+
+ // Test to make sure that all parameters can be set simultaneously with no
+ // ill effects.
+ public function testCanSetAllParameters()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setNickname("foo");
+ $this->query->setUsername("bar");
+ $this->query->setStartNickname("baz");
+ $this->assertEquals("foo", $this->query->getNickname());
+ $this->assertEquals("bar", $this->query->getUsername());
+ $this->assertEquals("baz", $this->query->getStartNickname());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/foo?username=bar&startNickname=baz",
+ $this->query->getQueryUrl());
+
+ $this->query->setUsername("qux");
+ $this->query->setNickname("baz");
+ $this->query->setStartNickname("wibble");
+ $this->assertEquals("baz", $this->query->getNickname());
+ $this->assertEquals("qux", $this->query->getUsername());
+ $this->assertEquals("wibble", $this->query->getStartNickname());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/nickname/2.0/baz?username=qux&startNickname=wibble",
+ $this->query->getQueryUrl());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/NicknameTest.php b/zend/tests/Zend/Gdata/Gapps/NicknameTest.php
new file mode 100644
index 0000000..c668c22
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/NicknameTest.php
@@ -0,0 +1,126 @@
+<?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_Gapps
+ * @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/Gapps/Extension/Nickname.php';
+require_once 'Zend/Gdata.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_NicknameTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->nicknameText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/NicknameElementSample1.xml',
+ true);
+ $this->nickname = new Zend_Gdata_Gapps_Extension_Nickname();
+ }
+
+ public function testEmptyNicknameShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->nickname->extensionElements));
+ $this->assertTrue(count($this->nickname->extensionElements) == 0);
+ }
+
+ public function testEmptyNicknameShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->nickname->extensionAttributes));
+ $this->assertTrue(count($this->nickname->extensionAttributes) == 0);
+ }
+
+ public function testSampleNicknameShouldHaveNoExtensionElements() {
+ $this->nickname->transferFromXML($this->nicknameText);
+ $this->assertTrue(is_array($this->nickname->extensionElements));
+ $this->assertTrue(count($this->nickname->extensionElements) == 0);
+ }
+
+ public function testSampleNicknameShouldHaveNoExtensionAttributes() {
+ $this->nickname->transferFromXML($this->nicknameText);
+ $this->assertTrue(is_array($this->nickname->extensionAttributes));
+ $this->assertTrue(count($this->nickname->extensionAttributes) == 0);
+ }
+
+ public function testNormalNicknameShouldHaveNoExtensionElements() {
+ $this->nickname->name = "Trogdor";
+
+ $this->assertEquals("Trogdor", $this->nickname->name);
+
+ $this->assertEquals(0, count($this->nickname->extensionElements));
+ $newNickname = new Zend_Gdata_Gapps_Extension_Nickname();
+ $newNickname->transferFromXML($this->nickname->saveXML());
+ $this->assertEquals(0, count($newNickname->extensionElements));
+ $newNickname->extensionElements = array(
+ new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
+ $this->assertEquals(1, count($newNickname->extensionElements));
+ $this->assertEquals("Trogdor", $newNickname->name);
+
+ /* try constructing using magic factory */
+ $gdata = new Zend_Gdata_Gapps();
+ $newNickname2 = $gdata->newNickname();
+ $newNickname2->transferFromXML($newNickname->saveXML());
+ $this->assertEquals(1, count($newNickname2->extensionElements));
+ $this->assertEquals("Trogdor", $newNickname2->name);
+ }
+
+ public function testEmptyNicknameToAndFromStringShouldMatch() {
+ $nicknameXml = $this->nickname->saveXML();
+ $newNickname = new Zend_Gdata_Gapps_Extension_Nickname();
+ $newNickname->transferFromXML($nicknameXml);
+ $newNicknameXml = $newNickname->saveXML();
+ $this->assertTrue($nicknameXml == $newNicknameXml);
+ }
+
+ public function testNicknameWithValueToAndFromStringShouldMatch() {
+ $this->nickname->name = "Trogdor";
+ $nicknameXml = $this->nickname->saveXML();
+ $newNickname = new Zend_Gdata_Gapps_Extension_Nickname();
+ $newNickname->transferFromXML($nicknameXml);
+ $newNicknameXml = $newNickname->saveXML();
+ $this->assertTrue($nicknameXml == $newNicknameXml);
+ $this->assertEquals("Trogdor", $this->nickname->name);
+ }
+
+ public function testExtensionAttributes() {
+ $extensionAttributes = $this->nickname->extensionAttributes;
+ $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar');
+ $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab');
+ $this->nickname->extensionAttributes = $extensionAttributes;
+ $this->assertEquals('bar', $this->nickname->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $this->nickname->extensionAttributes['foo2']['value']);
+ $nicknameXml = $this->nickname->saveXML();
+ $newNickname = new Zend_Gdata_Gapps_Extension_Nickname();
+ $newNickname->transferFromXML($nicknameXml);
+ $this->assertEquals('bar', $newNickname->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $newNickname->extensionAttributes['foo2']['value']);
+ }
+
+ public function testConvertFullNicknameToAndFromString() {
+ $this->nickname->transferFromXML($this->nicknameText);
+ $this->assertEquals("Jones", $this->nickname->name);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/OwnerEntryTest.php b/zend/tests/Zend/Gdata/Gapps/OwnerEntryTest.php
new file mode 100644
index 0000000..1e20636
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/OwnerEntryTest.php
@@ -0,0 +1,104 @@
+<?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_Gapps
+ * @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/Gapps/OwnerEntry.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_OwnerEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->entryText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml',
+ true);
+ $this->entry = new Zend_Gdata_Gapps_OwnerEntry();
+ }
+
+ private function verifyAllSamplePropertiesAreCorrect ($ownerEntry) {
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com',
+ $ownerEntry->id->text);
+ $this->assertEquals('1970-01-01T00:00:00.000Z', $ownerEntry->updated->text);
+ $this->assertEquals('self', $ownerEntry->getLink('self')->rel);
+ $this->assertEquals('application/atom+xml', $ownerEntry->getLink('self')->type);
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com', $ownerEntry->getLink('self')->href);
+ $this->assertEquals('edit', $ownerEntry->getLink('edit')->rel);
+ $this->assertEquals('application/atom+xml', $ownerEntry->getLink('edit')->type);
+ $this->assertEquals('https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com', $ownerEntry->getLink('edit')->href);
+ $this->assertEquals('email', $ownerEntry->property[0]->name);
+ $this->assertEquals('joe@example.com', $ownerEntry->property[0]->value);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionElements() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionAttributes() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testEmptyOwnerEntryToAndFromStringShouldMatch() {
+ $entryXml = $this->entry->saveXML();
+ $newOwnerEntry = new Zend_Gdata_Gapps_OwnerEntry();
+ $newOwnerEntry->transferFromXML($entryXml);
+ $newOwnerEntryXml = $newOwnerEntry->saveXML();
+ $this->assertTrue($entryXml == $newOwnerEntryXml);
+ }
+
+ public function testSamplePropertiesAreCorrect () {
+ $this->entry->transferFromXML($this->entryText);
+ $this->verifyAllSamplePropertiesAreCorrect($this->entry);
+ }
+
+ public function testConvertOwnerEntryToAndFromString() {
+ $this->entry->transferFromXML($this->entryText);
+ $entryXml = $this->entry->saveXML();
+ $newOwnerEntry = new Zend_Gdata_Gapps_OwnerEntry();
+ $newOwnerEntry->transferFromXML($entryXml);
+ $this->verifyAllSamplePropertiesAreCorrect($newOwnerEntry);
+ $newOwnerEntryXml = $newOwnerEntry->saveXML();
+ $this->assertEquals($entryXml, $newOwnerEntryXml);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/OwnerFeedTest.php b/zend/tests/Zend/Gdata/Gapps/OwnerFeedTest.php
new file mode 100644
index 0000000..eb0810b
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/OwnerFeedTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/OwnerFeed.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_OwnerFeedTest extends PHPUnit_Framework_TestCase
+{
+ protected $ownerFeed = null;
+
+ /**
+ * Called before each test to setup any fixtures.
+ */
+ public function setUp()
+ {
+ $ownerFeedText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml',
+ true);
+ $this->ownerFeed = new Zend_Gdata_Gapps_OwnerFeed($ownerFeedText);
+ $this->emptyOwnerFeed = new Zend_Gdata_Gapps_OwnerFeed();
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emptyOwnerFeed->extensionElements));
+ $this->assertTrue(count($this->emptyOwnerFeed->extensionElements) == 0);
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emptyOwnerFeed->extensionAttributes));
+ $this->assertTrue(count($this->emptyOwnerFeed->extensionAttributes) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->ownerFeed->extensionElements));
+ $this->assertTrue(count($this->ownerFeed->extensionElements) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->ownerFeed->extensionAttributes));
+ $this->assertTrue(count($this->ownerFeed->extensionAttributes) == 0);
+ }
+
+ /**
+ * Convert sample feed to XML then back to objects. Ensure that
+ * all objects are instances of OwnerEntry and object count matches.
+ */
+ public function testXmlImportAndOutputAreNonDestructive()
+ {
+ $entryCount = 0;
+ foreach ($this->ownerFeed as $entry) {
+ $entryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_OwnerEntry);
+ }
+ $this->assertTrue($entryCount > 0);
+
+ /* Grab XML from $this->ownerFeed and convert back to objects */
+ $newOwnerFeed = new Zend_Gdata_Gapps_OwnerFeed(
+ $this->ownerFeed->saveXML());
+ $newEntryCount = 0;
+ foreach ($newOwnerFeed as $entry) {
+ $newEntryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_OwnerEntry);
+ }
+ $this->assertEquals($entryCount, $newEntryCount);
+ }
+
+ /**
+ * Ensure that there number of owner entries equals the number
+ * of owners defined in the sample file.
+ */
+ public function testAllEntriesInFeedAreInstantiated()
+ {
+ //TODO feeds implementing ArrayAccess would be helpful here
+ $entryCount = 0;
+ foreach ($this->ownerFeed as $entry) {
+ $entryCount++;
+ }
+ $this->assertEquals(2, $entryCount);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/OwnerQueryTest.php b/zend/tests/Zend/Gdata/Gapps/OwnerQueryTest.php
new file mode 100644
index 0000000..69342aa
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/OwnerQueryTest.php
@@ -0,0 +1,91 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/OwnerQuery.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_OwnerQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->query = new Zend_Gdata_Gapps_OwnerQuery();
+ }
+
+ // Test to make sure that the domain accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetQueryDomain()
+ {
+ $this->query->setGroupId("something");
+ $this->query->setDomain("my.domain.com");
+ $this->assertEquals("my.domain.com", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/something/owner",
+ $this->query->getQueryUrl());
+
+ $this->query->setDomain("hello.world.baz");
+ $this->assertEquals("hello.world.baz", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/hello.world.baz/something/owner",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the groupId accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetGroupIdProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setGroupId("foo");
+ $this->assertEquals("foo", $this->query->getGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner",
+ $this->query->getQueryUrl());
+
+ $this->query->setGroupId("bar");
+ $this->assertEquals("bar", $this->query->getGroupId());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/bar/owner",
+ $this->query->getQueryUrl());
+ }
+
+ public function testCanSetOwnerEmailProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setGroupId("foo");
+ $this->query->setOwnerEmail("bar@blah.com");
+ $this->assertEquals("bar@blah.com", $this->query->getOwnerEmail());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner/bar@blah.com",
+ $this->query->getQueryUrl());
+
+ $this->query->setOwnerEmail('baz@blah.com');
+ $this->assertEquals('baz@blah.com', $this->query->getOwnerEmail());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/group/2.0/my.domain.com/foo/owner/baz@blah.com",
+ $this->query->getQueryUrl());
+ }
+
+}
+
diff --git a/zend/tests/Zend/Gdata/Gapps/PropertyTest.php b/zend/tests/Zend/Gdata/Gapps/PropertyTest.php
new file mode 100644
index 0000000..b16abf6
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/PropertyTest.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_Gapps
+ * @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/Gapps/Extension/Property.php';
+require_once 'Zend/Gdata.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_PropertyTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->thePropertyText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/PropertyElementSample1.xml',
+ true);
+ $this->theProperty = new Zend_Gdata_Gapps_Extension_Property();
+ }
+
+ public function testEmptyPropertyShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->theProperty->extensionElements));
+ $this->assertTrue(count($this->theProperty->extensionElements) == 0);
+ }
+
+ public function testEmptyPropertyShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->theProperty->extensionAttributes));
+ $this->assertTrue(count($this->theProperty->extensionAttributes) == 0);
+ }
+
+ public function testSamplePropertyShouldHaveNoExtensionElements() {
+ $this->theProperty->transferFromXML($this->thePropertyText);
+ $this->assertTrue(is_array($this->theProperty->extensionElements));
+ $this->assertTrue(count($this->theProperty->extensionElements) == 0);
+ }
+
+ public function testSamplePropertyShouldHaveNoExtensionAttributes() {
+ $this->theProperty->transferFromXML($this->thePropertyText);
+ $this->assertTrue(is_array($this->theProperty->extensionAttributes));
+ $this->assertTrue(count($this->theProperty->extensionAttributes) == 0);
+ }
+
+ public function testNormalPropertyShouldHaveNoExtensionElements() {
+ $this->theProperty->name = "foo";
+ $this->theProperty->value = "bar";
+
+ $this->assertEquals("foo", $this->theProperty->name);
+ $this->assertEquals("bar", $this->theProperty->value);
+
+ $this->assertEquals(0, count($this->theProperty->extensionElements));
+ $newProperty = new Zend_Gdata_Gapps_Extension_Property();
+ $newProperty->transferFromXML($this->theProperty->saveXML());
+ $this->assertEquals(0, count($newProperty->extensionElements));
+ $newProperty->extensionElements = array(
+ new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
+ $this->assertEquals(1, count($newProperty->extensionElements));
+ $this->assertEquals("foo", $newProperty->name);
+ $this->assertEquals("bar", $newProperty->value);
+
+ /* try constructing using magic factory */
+ $gdata = new Zend_Gdata_Gapps();
+ $newProperty2 = $gdata->newProperty();
+ $newProperty2->transferFromXML($newProperty->saveXML());
+ $this->assertEquals(1, count($newProperty2->extensionElements));
+ $this->assertEquals("foo", $newProperty2->name);
+ $this->assertEquals("bar", $newProperty2->value);
+ }
+
+ public function testEmptyPropertyToAndFromStringShouldMatch() {
+ $propertyXml = $this->theProperty->saveXML();
+ $newProperty = new Zend_Gdata_Gapps_Extension_Property();
+ $newProperty->transferFromXML($propertyXml);
+ $newPropertyXml = $newProperty->saveXML();
+ $this->assertTrue($propertyXml == $newPropertyXml);
+ }
+
+ public function testPropertyWithValueToAndFromStringShouldMatch() {
+ $this->theProperty->name = "foo2";
+ $this->theProperty->value = "bar2";
+ $propertyXml = $this->theProperty->saveXML();
+ $newProperty = new Zend_Gdata_Gapps_Extension_Property();
+ $newProperty->transferFromXML($propertyXml);
+ $newPropertyXml = $newProperty->saveXML();
+ $this->assertTrue($propertyXml == $newPropertyXml);
+ $this->assertEquals("foo2", $this->theProperty->name);
+ $this->assertEquals("bar2", $this->theProperty->value);
+ }
+
+ public function testExtensionAttributes() {
+ $extensionAttributes = $this->theProperty->extensionAttributes;
+ $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar');
+ $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab');
+ $this->theProperty->extensionAttributes = $extensionAttributes;
+ $this->assertEquals('bar', $this->theProperty->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $this->theProperty->extensionAttributes['foo2']['value']);
+ $propertyXml = $this->theProperty->saveXML();
+ $newProperty = new Zend_Gdata_Gapps_Extension_Property();
+ $newProperty->transferFromXML($propertyXml);
+ $this->assertEquals('bar', $newProperty->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $newProperty->extensionAttributes['foo2']['value']);
+ }
+
+ public function testConvertFullNameToAndFromString() {
+ $this->theProperty->transferFromXML($this->thePropertyText);
+ $this->assertEquals("Some Name", $this->theProperty->name);
+ $this->assertEquals("Some Value", $this->theProperty->value);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/QuotaTest.php b/zend/tests/Zend/Gdata/Gapps/QuotaTest.php
new file mode 100644
index 0000000..040a160
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/QuotaTest.php
@@ -0,0 +1,126 @@
+<?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_Gapps
+ * @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/Gapps/Extension/Quota.php';
+require_once 'Zend/Gdata.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_QuotaTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->quotaText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/QuotaElementSample1.xml',
+ true);
+ $this->quota = new Zend_Gdata_Gapps_Extension_Quota();
+ }
+
+ public function testEmptyQuotaShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->quota->extensionElements));
+ $this->assertTrue(count($this->quota->extensionElements) == 0);
+ }
+
+ public function testEmptyQuotaShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->quota->extensionAttributes));
+ $this->assertTrue(count($this->quota->extensionAttributes) == 0);
+ }
+
+ public function testSampleQuotaShouldHaveNoExtensionElements() {
+ $this->quota->transferFromXML($this->quotaText);
+ $this->assertTrue(is_array($this->quota->extensionElements));
+ $this->assertTrue(count($this->quota->extensionElements) == 0);
+ }
+
+ public function testSampleQuotaShouldHaveNoExtensionAttributes() {
+ $this->quota->transferFromXML($this->quotaText);
+ $this->assertTrue(is_array($this->quota->extensionAttributes));
+ $this->assertTrue(count($this->quota->extensionAttributes) == 0);
+ }
+
+ public function testNormalQuotaShouldHaveNoExtensionElements() {
+ $this->quota->limit = "123456789";
+
+ $this->assertEquals("123456789", $this->quota->limit);
+
+ $this->assertEquals(0, count($this->quota->extensionElements));
+ $newQuota = new Zend_Gdata_Gapps_Extension_Quota();
+ $newQuota->transferFromXML($this->quota->saveXML());
+ $this->assertEquals(0, count($newQuota->extensionElements));
+ $newQuota->extensionElements = array(
+ new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
+ $this->assertEquals(1, count($newQuota->extensionElements));
+ $this->assertEquals("123456789", $newQuota->limit);
+
+ /* try constructing using magic factory */
+ $gdata = new Zend_Gdata_Gapps();
+ $newQuota2 = $gdata->newQuota();
+ $newQuota2->transferFromXML($newQuota->saveXML());
+ $this->assertEquals(1, count($newQuota2->extensionElements));
+ $this->assertEquals("123456789", $newQuota2->limit);
+ }
+
+ public function testEmptyQuotaToAndFromStringShouldMatch() {
+ $quotaXml = $this->quota->saveXML();
+ $newQuota = new Zend_Gdata_Gapps_Extension_Quota();
+ $newQuota->transferFromXML($quotaXml);
+ $newQuotaXml = $newQuota->saveXML();
+ $this->assertTrue($quotaXml == $newQuotaXml);
+ }
+
+ public function testQuotaWithValueToAndFromStringShouldMatch() {
+ $this->quota->limit = "123456789";
+ $quotaXml = $this->quota->saveXML();
+ $newQuota = new Zend_Gdata_Gapps_Extension_Quota();
+ $newQuota->transferFromXML($quotaXml);
+ $newQuotaXml = $newQuota->saveXML();
+ $this->assertTrue($quotaXml == $newQuotaXml);
+ $this->assertEquals("123456789", $this->quota->limit);
+ }
+
+ public function testExtensionAttributes() {
+ $extensionAttributes = $this->quota->extensionAttributes;
+ $extensionAttributes['foo1'] = array('name'=>'foo1', 'value'=>'bar');
+ $extensionAttributes['foo2'] = array('name'=>'foo2', 'value'=>'rab');
+ $this->quota->extensionAttributes = $extensionAttributes;
+ $this->assertEquals('bar', $this->quota->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $this->quota->extensionAttributes['foo2']['value']);
+ $quotaXml = $this->quota->saveXML();
+ $newQuota = new Zend_Gdata_Gapps_Extension_Quota();
+ $newQuota->transferFromXML($quotaXml);
+ $this->assertEquals('bar', $newQuota->extensionAttributes['foo1']['value']);
+ $this->assertEquals('rab', $newQuota->extensionAttributes['foo2']['value']);
+ }
+
+ public function testConvertFullQuotaToAndFromString() {
+ $this->quota->transferFromXML($this->quotaText);
+ $this->assertEquals("2048", $this->quota->limit);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php b/zend/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php
new file mode 100644
index 0000000..5a96290
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php
@@ -0,0 +1,128 @@
+<?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_Gapps
+ * @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/Gapps/ServiceException.php';
+require_once 'Zend/Gdata/Gapps/Error.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_ServiceExceptionTest extends PHPUnit_Framework_TestCase
+{
+ protected $fixture;
+ protected $data;
+
+ public function setUp() {
+ $this->xmlSample = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml',
+ true);
+ $this->fixture = new Zend_Gdata_Gapps_ServiceException();
+ $this->data[1] = new Zend_Gdata_Gapps_Error(1234, "foo", "bar");
+ $this->data[2] = new Zend_Gdata_Gapps_Error(4317, "blah", "woof");
+ $this->data[3] = new Zend_Gdata_Gapps_Error(5978, "blue", "puppy");
+ $this->data[4] = new Zend_Gdata_Gapps_Error(2398, "red", "kitten");
+ }
+
+ /**
+ * @expectedException Zend_Gdata_Gapps_ServiceException
+ */
+ public function testCanThrowServiceException() {
+ throw $this->fixture;
+ }
+
+ public function testCanSetAndGetErrorArray() {
+ $this->fixture->setErrors($this->data);
+ $incoming = $this->fixture->getErrors();
+ $this->assertTrue(is_array($incoming));
+ $this->assertEquals(count($this->data), count($incoming));
+ foreach ($this->data as $i) {
+ $this->assertEquals($i, $incoming[$i->getErrorCode()]);
+ }
+ }
+
+ public function testCanInsertSingleError() {
+ $this->fixture->setErrors($this->data);
+ $outgoing = new Zend_Gdata_Gapps_Error(1111, "a", "b");
+ $this->fixture->addError($outgoing);
+ $result = $this->fixture->getError(1111);
+ $this->assertEquals($outgoing, $result);
+ }
+
+ public function testCanSetPropertiesViaConstructor() {
+ $this->fixture = new Zend_Gdata_Gapps_ServiceException($this->data);
+ $incoming = $this->fixture->getErrors();
+ $this->assertTrue(is_array($incoming));
+ $this->assertEquals(count($this->data), count($incoming));
+ foreach($this->data as $i) {
+ $this->assertEquals($i, $incoming[$i->getErrorCode()]);
+ }
+ }
+
+ public function testCanRetrieveASpecificErrorByCode() {
+ $this->fixture->setErrors($this->data);
+ $result = $this->fixture->getError(5978);
+ $this->assertEquals($this->data[3], $result);
+ }
+
+ public function testRetrievingNonexistantErrorCodeReturnsNull() {
+ $this->fixture->setErrors($this->data);
+ $result = $this->fixture->getError(0000);
+ $this->assertEquals(null, $result);
+ }
+
+ public function testCanCheckIfAKeyExists() {
+ $this->fixture->setErrors($this->data);
+ $this->assertTrue($this->fixture->hasError(2398));
+ $this->assertFalse($this->fixture->hasError(0000));
+ }
+
+ public function testCanConvertFromXML() {
+ $this->fixture->importFromString($this->xmlSample);
+ $incoming = $this->fixture->getErrors();
+ $this->assertTrue(is_array($incoming));
+ $this->assertEquals(3, count($incoming));
+ $this->assertEquals("9925", $incoming[9925]->errorCode);
+ $this->assertEquals("Foo", $incoming[9925]->invalidInput);
+ $this->assertEquals("Bar", $incoming[9925]->reason);
+ }
+
+ public function testCanConvertToString() {
+ $this->fixture->setErrors($this->data);
+ $this->assertEquals("The server encountered the following errors processing the request:
+Error 1234: foo
+\tInvalid Input: \"bar\"
+Error 4317: blah
+\tInvalid Input: \"woof\"
+Error 5978: blue
+\tInvalid Input: \"puppy\"
+Error 2398: red
+\tInvalid Input: \"kitten\"", $this->fixture->__toString());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/UserEntryTest.php b/zend/tests/Zend/Gdata/Gapps/UserEntryTest.php
new file mode 100644
index 0000000..971d56b
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/UserEntryTest.php
@@ -0,0 +1,145 @@
+<?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_Gapps
+ * @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/Gapps/UserEntry.php';
+require_once 'Zend/Gdata/Gapps.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_UserEntryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp() {
+ $this->entryText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml',
+ true);
+ $this->entry = new Zend_Gdata_Gapps_UserEntry();
+ }
+
+ private function verifyAllSamplePropertiesAreCorrect ($userEntry) {
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones',
+ $userEntry->id->text);
+ $this->assertEquals('1970-01-01T00:00:00.000Z', $userEntry->updated->text);
+ $this->assertEquals('http://schemas.google.com/g/2005#kind', $userEntry->category[0]->scheme);
+ $this->assertEquals('http://schemas.google.com/apps/2006#user', $userEntry->category[0]->term);
+ $this->assertEquals('text', $userEntry->title->type);
+ $this->assertEquals('SusanJones', $userEntry->title->text);;
+ $this->assertEquals('self', $userEntry->getLink('self')->rel);
+ $this->assertEquals('application/atom+xml', $userEntry->getLink('self')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones', $userEntry->getLink('self')->href);
+ $this->assertEquals('edit', $userEntry->getLink('edit')->rel);
+ $this->assertEquals('application/atom+xml', $userEntry->getLink('edit')->type);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones', $userEntry->getLink('edit')->href);
+ $this->assertEquals('SusanJones', $userEntry->login->username);
+ $this->assertEquals('Jones', $userEntry->name->familyName);
+ $this->assertEquals('Susan', $userEntry->name->givenName);
+ $this->assertEquals('http://schemas.google.com/apps/2006#user.nicknames', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.nicknames')->rel);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/nickname/2.0?username=Susy-1321', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.nicknames')->href);
+ $this->assertEquals('http://schemas.google.com/apps/2006#user.emailLists', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.emailLists')->rel);
+ $this->assertEquals('https://apps-apis.google.com/a/feeds/example.com/emailList/2.0?recipient=us-sales@example.com', $userEntry->getFeedLink('http://schemas.google.com/apps/2006#user.emailLists')->href);
+ $this->assertEquals('2048', $userEntry->quota->limit);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testEmptyEntryShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionElements() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionElements));
+ $this->assertTrue(count($this->entry->extensionElements) == 0);
+ }
+
+ public function testSampleEntryShouldHaveNoExtensionAttributes() {
+ $this->entry->transferFromXML($this->entryText);
+ $this->assertTrue(is_array($this->entry->extensionAttributes));
+ $this->assertTrue(count($this->entry->extensionAttributes) == 0);
+ }
+
+ public function testEmptyUserEntryToAndFromStringShouldMatch() {
+ $entryXml = $this->entry->saveXML();
+ $newUserEntry = new Zend_Gdata_Gapps_UserEntry();
+ $newUserEntry->transferFromXML($entryXml);
+ $newUserEntryXml = $newUserEntry->saveXML();
+ $this->assertTrue($entryXml == $newUserEntryXml);
+ }
+
+ public function testGetFeedLinkReturnsAllStoredEntriesWhenUsedWithNoParameters() {
+ // Prepare test data
+ $entry1 = new Zend_Gdata_Extension_FeedLink();
+ $entry1->rel = "first";
+ $entry1->href= "foo";
+ $entry2 = new Zend_Gdata_Extension_FeedLink();
+ $entry2->rel = "second";
+ $entry2->href= "bar";
+ $data = array($entry1, $entry2);
+
+ // Load test data and run test
+ $this->entry->feedLink = $data;
+ $this->assertEquals(2, count($this->entry->feedLink));
+ }
+
+ public function testGetFeedLinkCanReturnEntriesByRelValue() {
+ // Prepare test data
+ $entry1 = new Zend_Gdata_Extension_FeedLink();
+ $entry1->rel = "first";
+ $entry1->href= "foo";
+ $entry2 = new Zend_Gdata_Extension_FeedLink();
+ $entry2->rel = "second";
+ $entry2->href= "bar";
+ $data = array($entry1, $entry2);
+
+ // Load test data and run test
+ $this->entry->feedLink = $data;
+ $this->assertEquals($entry1, $this->entry->getFeedLink('first'));
+ $this->assertEquals($entry2, $this->entry->getFeedLink('second'));
+ }
+
+ public function testSamplePropertiesAreCorrect () {
+ $this->entry->transferFromXML($this->entryText);
+ $this->verifyAllSamplePropertiesAreCorrect($this->entry);
+ }
+
+ public function testConvertUserEntryToAndFromString() {
+ $this->entry->transferFromXML($this->entryText);
+ $entryXml = $this->entry->saveXML();
+ $newUserEntry = new Zend_Gdata_Gapps_UserEntry();
+ $newUserEntry->transferFromXML($entryXml);
+ $this->verifyAllSamplePropertiesAreCorrect($newUserEntry);
+ $newUserEntryXml = $newUserEntry->saveXML();
+ $this->assertEquals($entryXml, $newUserEntryXml);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/UserFeedTest.php b/zend/tests/Zend/Gdata/Gapps/UserFeedTest.php
new file mode 100644
index 0000000..1fc4793
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/UserFeedTest.php
@@ -0,0 +1,109 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/UserFeed.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_UserFeedTest extends PHPUnit_Framework_TestCase
+{
+ protected $userFeed = null;
+
+ /**
+ * Called before each test to setup any fixtures.
+ */
+ public function setUp()
+ {
+ $userFeedText = file_get_contents(
+ 'Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml',
+ true);
+ $this->userFeed = new Zend_Gdata_Gapps_UserFeed($userFeedText);
+ $this->emptyUserFeed = new Zend_Gdata_Gapps_UserFeed();
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->emptyUserFeed->extensionElements));
+ $this->assertTrue(count($this->emptyUserFeed->extensionElements) == 0);
+ }
+
+ public function testEmptyFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->emptyUserFeed->extensionAttributes));
+ $this->assertTrue(count($this->emptyUserFeed->extensionAttributes) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionElements() {
+ $this->assertTrue(is_array($this->userFeed->extensionElements));
+ $this->assertTrue(count($this->userFeed->extensionElements) == 0);
+ }
+
+ public function testSampleFeedShouldHaveNoExtensionAttributes() {
+ $this->assertTrue(is_array($this->userFeed->extensionAttributes));
+ $this->assertTrue(count($this->userFeed->extensionAttributes) == 0);
+ }
+
+ /**
+ * Convert sample feed to XML then back to objects. Ensure that
+ * all objects are instances of EventEntry and object count matches.
+ */
+ public function testXmlImportAndOutputAreNonDestructive()
+ {
+ $entryCount = 0;
+ foreach ($this->userFeed as $entry) {
+ $entryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_UserEntry);
+ }
+ $this->assertTrue($entryCount > 0);
+
+ /* Grab XML from $this->userFeed and convert back to objects */
+ $newUserFeed = new Zend_Gdata_Gapps_UserFeed(
+ $this->userFeed->saveXML());
+ $newEntryCount = 0;
+ foreach ($newUserFeed as $entry) {
+ $newEntryCount++;
+ $this->assertTrue($entry instanceof Zend_Gdata_Gapps_UserEntry);
+ }
+ $this->assertEquals($entryCount, $newEntryCount);
+ }
+
+ /**
+ * Ensure that there number of lsit feeds equals the number
+ * of calendars defined in the sample file.
+ */
+ public function testAllEntriesInFeedAreInstantiated()
+ {
+ //TODO feeds implementing ArrayAccess would be helpful here
+ $entryCount = 0;
+ foreach ($this->userFeed as $entry) {
+ $entryCount++;
+ }
+ $this->assertEquals(2, $entryCount);
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/UserQueryTest.php b/zend/tests/Zend/Gdata/Gapps/UserQueryTest.php
new file mode 100644
index 0000000..7a94f31
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/UserQueryTest.php
@@ -0,0 +1,98 @@
+<?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_Gapps
+ * @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/Gapps.php';
+require_once 'Zend/Gdata/Gapps/UserQuery.php';
+
+/**
+ * @category Zend
+ * @package Zend_Gdata_Gapps
+ * @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_Gapps
+ */
+class Zend_Gdata_Gapps_UserQueryTest extends PHPUnit_Framework_TestCase
+{
+
+ public function setUp()
+ {
+ $this->query = new Zend_Gdata_Gapps_UserQuery();
+ }
+
+ // Test to make sure that URI generation works
+ public function testDefaultQueryURIGeneration()
+ {
+ $this->query->setDomain("foo.bar.invalid");
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/foo.bar.invalid/user/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the domain accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetQueryDomain()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->assertEquals("my.domain.com", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0",
+ $this->query->getQueryUrl());
+
+ $this->query->setDomain("hello.world.baz");
+ $this->assertEquals("hello.world.baz", $this->query->getDomain());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/hello.world.baz/user/2.0",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the username accessor methods work and propagate
+ // to the query URI.
+ public function testCanSetUsernameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setUsername("foo");
+ $this->assertEquals("foo", $this->query->getUsername());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0/foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setUsername("bar");
+ $this->assertEquals("bar", $this->query->getUsername());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0/bar",
+ $this->query->getQueryUrl());
+ }
+
+ // Test to make sure that the startUsername accessor methods work and
+ // propagate to the query URI.
+ public function testCanSetStartUsernameProperty()
+ {
+ $this->query->setDomain("my.domain.com");
+ $this->query->setStartUsername("foo");
+ $this->assertEquals("foo", $this->query->getStartUsername());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0?startUsername=foo",
+ $this->query->getQueryUrl());
+
+ $this->query->setStartUsername(null);
+ $this->assertEquals(null, $this->query->getStartUsername());
+ $this->assertEquals("https://apps-apis.google.com/a/feeds/my.domain.com/user/2.0",
+ $this->query->getQueryUrl());
+ }
+
+}
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml
new file mode 100644
index 0000000..e4ec89f
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<AppsForYourDomainErrors>
+ <error errorCode="1301" invalidInput="ZF-4699719c8e74c" reason="EntityDoesNotExist" />
+ <error errorCode="9925" invalidInput="Foo" reason="Bar" />
+ <error errorCode="5235" invalidInput="HelloWorld" reason="Blah" />
+</AppsForYourDomainErrors>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml
new file mode 100644
index 0000000..09349e8
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apps:emailList xmlns:apps="http://schemas.google.com/apps/2006" name="us-sales"/>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml
new file mode 100644
index 0000000..ddbd2c7
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList"/>
+ <atom:title type="text">us-sales</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales"/>
+ <apps:emailList name="us-sales"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#emailList.recipients"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/"/>
+</atom:entry>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml
new file mode 100644
index 0000000..8d779c7
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/emailList/2.0
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList"/>
+ <atom:title type="text">EmailLists</atom:title>
+ <atom:link rel="next" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0?startEmailListName=john"/>
+ <atom:link rel="http://schemas.google.com/g/2005#feed"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0"/>
+ <atom:link rel="http://schemas.google.com/g/2005#post"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0"/>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0"/>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList"/>
+ <atom:title type="text">us-sales</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales"/>
+ <apps:emailList name="us-sales"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#emailList.recipients"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/"/>
+ </atom:entry>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-eng
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList"/>
+ <atom:title type="text">us-eng</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-eng"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-eng"/>
+ <apps:emailList name="us-eng"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#emailList.recipients"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-eng/recipient/"/>
+ </atom:entry>
+</atom:feed>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml
new file mode 100644
index 0000000..8bd3c8d
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList.recipient"/>
+ <atom:title type="text">SusanJones</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com"/>
+ <gd:who email="SusanJones@example.com"/>
+</atom:entry>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml
new file mode 100644
index 0000000..b217c0d
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList.recipient"/>
+ <atom:title type="text">Recipients for email list us-sales</atom:title>
+ <atom:link rel="next" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/?startRecipient=terry@example.com"/>
+ <atom:link rel="http://schemas.google.com/g/2005#feed"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient"/>
+ <atom:link rel="http://schemas.google.com/g/2005#post"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient"/>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient"/>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/joe%40example.com
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList.recipient"/>
+ <atom:title type="text">joe@example.com</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/joe%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/joe%40example.com"/>
+ <gd:who email="joe@example.com"/>
+ </atom:entry>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/susan%40example.com
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#emailList.recipient"/>
+ <atom:title type="text">susan@example.com</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/susan%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/susan%40example.com"/>
+ <gd:who email="susan@example.com"/>
+ </atom:entry>
+</atom:feed>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml
new file mode 100644
index 0000000..a23e6b5
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:link rel="self" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales"/>
+ <atom:link rel="edit" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales"/>
+ <apps:property name="groupId" value="us-sales"></apps:property>
+ <apps:property name="groupName" value="us-sales"></apps:property>
+ <apps:property name="description" value="UnitedStatesSalesTeam"></apps:property>
+ <apps:property name="emailPermission" value="Domain"></apps:property>
+</atom:entry>
+
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml
new file mode 100644
index 0000000..c37ec26
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"
+xmlns:apps="http://schemas.google.com/apps/2006"
+xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com</atom:id>
+ <atom:updated>2008-12-03T16:33:05.260Z</atom:updated>
+ <atom:link href="https://apps-apis.google.com/a/feeds/group/2.0/example.com" type="application/atom+xml" rel="http://schemas.google.com/g/2005#feed"></atom:link>
+ <atom:link href="https://apps-apis.google.com/a/feeds/group/2.0/example.com" type="application/atom+xml" rel="http://schemas.google.com/g/2005#post"></atom:link>
+ <atom:link href="https://apps-apis.google.com/a/feeds/group/2.0/example.com" type="application/atom+xml" rel="self"></atom:link>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <atom:entry>
+ <id>https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales%40example.com</id>
+ <atom:updated>2008-12-03T16:33:05.261Z</atom:updated>
+ <atom:link href="https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales%40example.com" type="application/atom+xml" rel="self"></atom:link>
+ <atom:link href="https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales%40example.com" type="application/atom+xml" rel="edit"></atom:link>
+ <apps:property name="groupId" value="us-sales@example.com"></apps:property>
+ <apps:property name="groupName" value="US Sales"></apps:property>
+ <apps:property name="emailPermission" value="Anyone"></apps:property>
+ <apps:property name="description" value="United States Sales Team"></apps:property>
+ </atom:entry>
+ <atom:entry>
+ <atom:id>https://apps-apis.google.com/a/feeds/group/2.0/example.com/Staff-2435%40example.com</atom:id>
+ <atom:updated>2008-12-03T16:33:05.260Z</atom:updated>
+ <atom:link href="https://apps-apis.google.com/a/feeds/group/2.0/example.com/Staff-2435%40example.com" type="application/atom+xml" rel="self"></atom:link>
+ <atom:link href="https://apps-apis.google.com/a/feeds/group/2.0/example.com/Staff-2435%40example.com" type="application/atom+xml" rel="edit"></atom:link>
+ <apps:property name="groupId" value="Staff-2435@example.com"></apps:property>
+ <apps:property name="groupName" value="Staff 2435"></apps:property>
+ <apps:property name="emailPermission" value="Anyone"></apps:property>
+ <apps:property name="description" value=""></apps:property>
+ </atom:entry>
+</atom:feed> \ No newline at end of file
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml
new file mode 100644
index 0000000..f6971dc
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apps:login xmlns:apps="http://schemas.google.com/apps/2006" userName="SusanJones-1321" password="123$$abc" hashFunctionName="SHA-1" suspended="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml
new file mode 100644
index 0000000..953fa2a
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:link rel="self" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com"/>
+ <apps:property name="memberId" value="suejones@example.com"/>
+ <apps:property name="memberType" value="User"/>
+ <apps:property name="directMember" value="true"/>
+</atom:entry>
+
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml
new file mode 100644
index 0000000..aa395ff
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member</atom:id>
+ <atom:link rel="https://schemas.google.com/g/2005#feed" type="application/atom+xml"
+ href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member"/>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <atom:entry>
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com</atom:id>
+ <atom:link rel="self" type="application/atom+xml"
+href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml"
+href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com"/>
+ <apps:property name="memberId" value="suejones@example.com"/>
+ <apps:property name="memberType" value="User"/>
+ <apps:property name="directMember" value="true"/>
+ </atom:entry>
+ <atom:entry>
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/ca-sales%40example.com</atom:id>
+ <atom:link rel="self" type="application/atom+xml"
+href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/ca-sales%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml"
+href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/ca-sales%40example.com"/>
+ <apps:property name="memberId" value="ca-sales@example.com"/>
+ <apps:property name="memberType" value="Group"/>
+ <apps:property name="directMember" value="true"/>
+ </atom:entry>
+</atom:feed> \ No newline at end of file
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml
new file mode 100644
index 0000000..4b30681
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apps:name xmlns:apps="http://schemas.google.com/apps/2006" familyName="Jones" givenName="Susan"/>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml
new file mode 100644
index 0000000..a986073
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apps:nickname xmlns:apps="http://schemas.google.com/apps/2006" name="Jones"/>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml
new file mode 100644
index 0000000..8c165ce
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#nickname"/>
+ <atom:title type="text">Susy</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy"/>
+ <apps:nickname name="Susy"/>
+ <apps:login userName="SusanJones" suspended="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
+</atom:entry>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml
new file mode 100644
index 0000000..9598bf4
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:apps="http://schemas.google.com/apps/2006">
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/nickname/2.0
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#nickname"/>
+ <atom:title type="text">Nicknames for user SusanJones</atom:title>
+ <atom:link rel="http://schemas.google.com/g/2005#feed"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0"/>
+ <atom:link rel="http://schemas.google.com/g/2005#post"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0"/>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0?username=SusanJones"/>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <openSearch:itemsPerPage>2</openSearch:itemsPerPage>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/susy
+ </atom:id>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#nickname"/>
+ <atom:title type="text">susy</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/susy"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/susy"/>
+ <apps:nickname name="susy"/>
+ <apps:login userName="SusanJones" suspended="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
+ </atom:entry>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse
+ </atom:id>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#nickname"/>
+ <atom:title type="text">suse</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse"/>
+ <apps:nickname name="suse"/>
+ <apps:login userName="SusanJones" suspended="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
+ </atom:entry>
+</atom:feed>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml
new file mode 100644
index 0000000..c59c87b
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:gd="http://schemas.google.com/g/2005" >
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:link rel="self" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com"/>
+ <apps:property name="email" value="joe@example.com"/>
+</atom:entry>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml
new file mode 100644
index 0000000..bf1c775
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml
@@ -0,0 +1,30 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<atom:feed xmlns:atom='http://www.w3.org/2005/Atom'
+ xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
+ xmlns:apps='http://schemas.google.com/apps/2006'>
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:link rel='http://schemas.google.com/g/2005#feed'
+ type='application/atom+xml'
+ href='https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner'/>
+ <atom:link rel='http://schemas.google.com/g/2005#post'
+ type='application/atom+xml'
+ href='https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner'/>
+ <atom:link rel='self' type='application/atom+xml'
+ href='https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner'/>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <atom:entry>
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:link rel="self" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com"/>
+ <apps:property name="email" value="joe@example.com"/>
+ </atom:entry>
+ <atom:entry>
+ <atom:id>https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/suejones%40example.com</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:link rel="self" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/suejones%40example.com"/>
+ <atom:link rel="edit" type="application/atom+xml" href="https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/suejones%40example.com"/>
+ <apps:property name="email" value="suejones@example.com"/>
+ </atom:entry>
+</atom:feed>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml
new file mode 100644
index 0000000..7402071
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apps:property xmlns:apps="http://schemas.google.com/apps/2006" name="Some Name" value="Some Value" />
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml
new file mode 100644
index 0000000..f516dbd
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<apps:quota xmlns:apps="http://schemas.google.com/apps/2006" limit="2048"/>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml
new file mode 100644
index 0000000..0754443
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:entry xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones</atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#user"/>
+ <atom:title type="text">SusanJones</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones"/>
+ <apps:login userName="SusanJones"/>
+ <apps:name familyName="Jones" givenName="Susan"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#user.nicknames"
+ href="https://apps-apis.google.com/a/feeds/example.com/nickname/2.0?username=Susy-1321"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#user.emailLists" href="https://apps-apis.google.com/a/feeds/example.com/emailList/2.0?recipient=us-sales@example.com"/>
+ <apps:quota limit="2048"/>
+</atom:entry>
diff --git a/zend/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml b/zend/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml
new file mode 100644
index 0000000..ff4b78e
--- /dev/null
+++ b/zend/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<atom:feed xmlns:atom="http://www.w3.org/2005/Atom"
+ xmlns:apps="http://schemas.google.com/apps/2006"
+ xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
+ xmlns:gd="http://schemas.google.com/g/2005">
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/user/2.0
+ </atom:id>
+ <atom:updated>1970-01-01T00:00:00.000Z</atom:updated>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#user"/>
+ <atom:title type="text">Users</atom:title>
+ <atom:link rel="next" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0?startUsername=john"/>
+ <atom:link rel="http://schemas.google.com/g/2005#feed"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0"/>
+ <atom:link rel="http://schemas.google.com/g/2005#post"
+ type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0"/>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0"/>
+ <openSearch:startIndex>1</openSearch:startIndex>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones
+ </atom:id>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#user"/>
+ <atom:title type="text">SusanJones</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones"/>
+ <gd:who rel="http://schemas.google.com/apps/2006#user.recipient"
+ email="SusanJones@example.com"/>
+ <apps:login userName="SusanJones" suspended="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
+ <apps:quota limit="2048"/>
+ <apps:name familyName="Jones" givenName="Susan"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#user.nicknames"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0?username=SusanJones"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#user.emailLists"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0?recipient=SusanJones@example.com"/>
+ </atom:entry>
+ <atom:entry>
+ <atom:id>
+ http://apps-apis.google.com/a/feeds/example.com/user/2.0/JohnSmith
+ </atom:id>
+ <atom:category scheme="http://schemas.google.com/g/2005#kind"
+ term="http://schemas.google.com/apps/2006#user"/>
+ <atom:title type="text">JohnSmith</atom:title>
+ <atom:link rel="self" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0/JohnSmith"/>
+ <atom:link rel="edit" type="application/atom+xml"
+ href="http://apps-apis.google.com/a/feeds/example.com/user/2.0/JohnSmith"/>
+ <gd:who rel="http://schemas.google.com/apps/2006#user.recipient"
+ email="JohnSmith@example.com"/>
+ <apps:login userName="JohnSmith" suspended="false" admin="false" changePasswordAtNextLogin="false" agreedToTerms="true"/>
+ <apps:quota limit="2048"/>
+ <apps:name familyName="Smith" givenName="John"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#user.nicknames"
+ href="http://apps-apis.google.com/a/feeds/example.com/nickname/2.0?username=JohnSmith"/>
+ <gd:feedLink rel="http://schemas.google.com/apps/2006#user.emailLists"
+ href="http://apps-apis.google.com/a/feeds/example.com/emailList/2.0?recipient=JohnSmith@example.com"/>
+ </atom:entry>
+</atom:feed>