From 06f945f27840b53e57795dadbc38e76f7e11ab1c Mon Sep 17 00:00:00 2001 From: Horus3 Date: Mon, 24 Feb 2014 16:42:14 +0100 Subject: init --- zend/tests/Zend/Gdata/Gapps/EmailListEntryTest.php | 140 +++++++++++++++++ zend/tests/Zend/Gdata/Gapps/EmailListFeedTest.php | 109 +++++++++++++ zend/tests/Zend/Gdata/Gapps/EmailListQueryTest.php | 138 +++++++++++++++++ .../Gdata/Gapps/EmailListRecipientEntryTest.php | 107 +++++++++++++ .../Gdata/Gapps/EmailListRecipientFeedTest.php | 109 +++++++++++++ .../Gdata/Gapps/EmailListRecipientQueryTest.php | 90 +++++++++++ zend/tests/Zend/Gdata/Gapps/EmailListTest.php | 126 +++++++++++++++ zend/tests/Zend/Gdata/Gapps/ErrorTest.php | 88 +++++++++++ zend/tests/Zend/Gdata/Gapps/GroupEntryTest.php | 110 ++++++++++++++ zend/tests/Zend/Gdata/Gapps/GroupFeedTest.php | 109 +++++++++++++ zend/tests/Zend/Gdata/Gapps/GroupQueryTest.php | 168 ++++++++++++++++++++ zend/tests/Zend/Gdata/Gapps/LoginTest.php | 169 +++++++++++++++++++++ zend/tests/Zend/Gdata/Gapps/MemberEntryTest.php | 108 +++++++++++++ zend/tests/Zend/Gdata/Gapps/MemberFeedTest.php | 109 +++++++++++++ zend/tests/Zend/Gdata/Gapps/MemberQueryTest.php | 109 +++++++++++++ zend/tests/Zend/Gdata/Gapps/NameTest.php | 133 ++++++++++++++++ zend/tests/Zend/Gdata/Gapps/NicknameEntryTest.php | 112 ++++++++++++++ zend/tests/Zend/Gdata/Gapps/NicknameFeedTest.php | 109 +++++++++++++ zend/tests/Zend/Gdata/Gapps/NicknameQueryTest.php | 140 +++++++++++++++++ zend/tests/Zend/Gdata/Gapps/NicknameTest.php | 126 +++++++++++++++ zend/tests/Zend/Gdata/Gapps/OwnerEntryTest.php | 104 +++++++++++++ zend/tests/Zend/Gdata/Gapps/OwnerFeedTest.php | 109 +++++++++++++ zend/tests/Zend/Gdata/Gapps/OwnerQueryTest.php | 91 +++++++++++ zend/tests/Zend/Gdata/Gapps/PropertyTest.php | 133 ++++++++++++++++ zend/tests/Zend/Gdata/Gapps/QuotaTest.php | 126 +++++++++++++++ .../Zend/Gdata/Gapps/ServiceExceptionTest.php | 128 ++++++++++++++++ zend/tests/Zend/Gdata/Gapps/UserEntryTest.php | 145 ++++++++++++++++++ zend/tests/Zend/Gdata/Gapps/UserFeedTest.php | 109 +++++++++++++ zend/tests/Zend/Gdata/Gapps/UserQueryTest.php | 98 ++++++++++++ .../_files/AppsForYourDomainElementSample1.xml | 6 + .../Gdata/Gapps/_files/EmailListElementSample1.xml | 2 + .../Gapps/_files/EmailListEntryDataSample1.xml | 17 +++ .../Gapps/_files/EmailListFeedDataSample1.xml | 55 +++++++ .../_files/EmailListRecipientEntryDataSample1.xml | 15 ++ .../_files/EmailListRecipientFeedDataSample1.xml | 51 +++++++ .../Gdata/Gapps/_files/GroupEntryDataSample1.xml | 14 ++ .../Gdata/Gapps/_files/GroupFeedDataSample1.xml | 31 ++++ .../Gdata/Gapps/_files/LoginElementSample1.xml | 2 + .../Gdata/Gapps/_files/MemberEntryDataSample1.xml | 13 ++ .../Gdata/Gapps/_files/MemberFeedDataSample1.xml | 29 ++++ .../Zend/Gdata/Gapps/_files/NameElementSample1.xml | 2 + .../Gdata/Gapps/_files/NicknameElementSample1.xml | 2 + .../Gapps/_files/NicknameEntryDataSample1.xml | 16 ++ .../Gdata/Gapps/_files/NicknameFeedDataSample1.xml | 50 ++++++ .../Gdata/Gapps/_files/OwnerEntryDataSample1.xml | 10 ++ .../Gdata/Gapps/_files/OwnerFeedDataSample1.xml | 30 ++++ .../Gdata/Gapps/_files/PropertyElementSample1.xml | 2 + .../Gdata/Gapps/_files/QuotaElementSample1.xml | 2 + .../Gdata/Gapps/_files/UserEntryDataSample1.xml | 20 +++ .../Gdata/Gapps/_files/UserFeedDataSample1.xml | 66 ++++++++ 50 files changed, 3887 insertions(+) create mode 100644 zend/tests/Zend/Gdata/Gapps/EmailListEntryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/EmailListFeedTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/EmailListQueryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/EmailListRecipientEntryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/EmailListRecipientFeedTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/EmailListRecipientQueryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/EmailListTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/ErrorTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/GroupEntryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/GroupFeedTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/GroupQueryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/LoginTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/MemberEntryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/MemberFeedTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/MemberQueryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/NameTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/NicknameEntryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/NicknameFeedTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/NicknameQueryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/NicknameTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/OwnerEntryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/OwnerFeedTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/OwnerQueryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/PropertyTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/QuotaTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/ServiceExceptionTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/UserEntryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/UserFeedTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/UserQueryTest.php create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/AppsForYourDomainElementSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/EmailListElementSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/EmailListEntryDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/EmailListFeedDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientEntryDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/EmailListRecipientFeedDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/GroupEntryDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/GroupFeedDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/LoginElementSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/MemberEntryDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/MemberFeedDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/NameElementSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/NicknameElementSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/NicknameEntryDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/NicknameFeedDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/OwnerEntryDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/OwnerFeedDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/PropertyElementSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/QuotaElementSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/UserEntryDataSample1.xml create mode 100644 zend/tests/Zend/Gdata/Gapps/_files/UserFeedDataSample1.xml (limited to 'zend/tests/Zend/Gdata/Gapps') 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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ +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 @@ + + + + + + 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 @@ + + 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 @@ + + + https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales + 1970-01-01T00:00:00.000Z + + us-sales + + + + + 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 @@ + + + + http://apps-apis.google.com/a/feeds/example.com/emailList/2.0 + + 1970-01-01T00:00:00.000Z + + EmailLists + 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 @@ + + + https://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient/SusanJones%40example.com + 1970-01-01T00:00:00.000Z + + SusanJones + + + + 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 @@ + + + + http://apps-apis.google.com/a/feeds/example.com/emailList/2.0/us-sales/recipient + + 1970-01-01T00:00:00.000Z + + Recipients for email list us-sales + 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 @@ + + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales + 1970-01-01T00:00:00.000Z + + + + + + + + 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 @@ + + + https://www.google.com/a/feeds/group/2.0/example.com + 2008-12-03T16:33:05.260Z + + + + 1 + + https://apps-apis.google.com/a/feeds/group/2.0/example.com/us-sales%40example.com + 2008-12-03T16:33:05.261Z + + + + + + + + + https://apps-apis.google.com/a/feeds/group/2.0/example.com/Staff-2435%40example.com + 2008-12-03T16:33:05.260Z + + + + + + + + \ 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 @@ + + 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 @@ + + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com + 1970-01-01T00:00:00.000Z + + + + + + + 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 @@ + + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member + + 1 + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/suejones%40example.com + + + + + + + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/member/ca-sales%40example.com + + + + + + + \ 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 @@ + + 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 @@ + + 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 @@ + + + https://apps-apis.google.com/a/feeds/example.com/nickname/2.0/Susy + 1970-01-01T00:00:00.000Z + + Susy + + + + + 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 @@ + + + + http://apps-apis.google.com/a/feeds/example.com/nickname/2.0 + + 1970-01-01T00:00:00.000Z + + Nicknames for user SusanJones + + + + 1 + 2 + + + http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/susy + + + susy + + + + + + + + http://apps-apis.google.com/a/feeds/example.com/nickname/2.0/suse + + + suse + + + + + + 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 @@ + + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com + 1970-01-01T00:00:00.000Z + + + + 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 @@ + + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner + 1970-01-01T00:00:00.000Z + + + + 1 + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/joe%40example.com + 1970-01-01T00:00:00.000Z + + + + + + https://www.google.com/a/feeds/group/2.0/example.com/us-sales/owner/suejones%40example.com + 1970-01-01T00:00:00.000Z + + + + + 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 @@ + + 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 @@ + + 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 @@ + + + https://apps-apis.google.com/a/feeds/example.com/user/2.0/SusanJones + 1970-01-01T00:00:00.000Z + + SusanJones + + + + + + + + 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 @@ + + + + http://apps-apis.google.com/a/feeds/example.com/user/2.0 + + 1970-01-01T00:00:00.000Z + + Users + -- cgit v1.2.3