public function testUseH9() { $serviceName = Health::H9_SANDBOX_SERVICE_NAME; $client = GData\ClientLogin::getHttpClient($this->user, $this->pass, $serviceName); $h9 = new Health($client, 'google-MyPHPApp-v1.0', true); $profileListFeed = $h9->getHealthProfileListFeed(); $profileID = $profileListFeed->entry[0]->getProfileID(); $h9->setProfileID($profileID); // query profile feed $feed1 = $h9->getHealthProfileFeed(); $this->assertTrue($feed1 instanceof Health\ProfileFeed); foreach ($feed1->getEntries() as $entry) { $this->assertTrue($entry instanceof Health\ProfileEntry); $this->assertEquals($entry->getHttpClient(), $feed1->getHttpClient()); } // send CCR $subject = "Title of your notice goes here"; $body = "Notice body can contain <b>html</b> entities"; $type = "html"; $ccrXML = file_get_contents('Zend/GData/Health/_files/ccr_notice_sample.xml', true); $responseEntry = $h9->sendHealthNotice($subject, $body, $type, $ccrXML); $this->assertTrue($responseEntry instanceof Health\ProfileEntry); $this->assertEquals($subject, $responseEntry->title->text); $this->assertEquals($body, $responseEntry->content->text); $this->assertEquals($type, $responseEntry->content->type); $this->assertXmlStringEqualsXmlString($responseEntry->getCcr()->saveXML(), $ccrXML); }
public function testUserCRUDOperations() { // Create a new user $user = $this->gdata->createUser($this->id, self::GIVEN_NAME, self::FAMILY_NAME, sha1(self::PASSWORD), self::PASSWORD_HASH); $this->autoDelete($user); // Verify that returned values are correct $this->assertEquals($this->id, $user->login->username); $this->assertEquals(self::GIVEN_NAME, $user->name->givenName); $this->assertEquals(self::FAMILY_NAME, $user->name->familyName); // Since we can't retrieve the password or hash function via the // API, let's see if a ClientLogin auth request succeeds GData\ClientLogin::getHttpClient($this->id . '@' . $this->domain, self::PASSWORD, 'xapi'); // Check to make sure there are no extension elements/attributes // in the retrieved user $this->assertTrue(count($user->extensionElements) == 0); $this->assertTrue(count($user->extensionAttributes) == 0); // Try searching for the same user and make sure that they're returned $user2 = $this->gdata->retrieveUser($this->id); $this->assertEquals($user->saveXML(), $user2->saveXML()); // Delete user (uses builtin delete method, convenience delete // method tested further down) $user->delete(); // Ensure that user was deleted $deletedUser = $this->gdata->retrieveUser($this->id); $this->assertNull($deletedUser); }
public function setUp() { if (!constant('TESTS_ZEND_GDATA_ONLINE_ENABLED')) { $this->markTestSkipped('Zend_GData online tests are not enabled'); } $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $service = 'lh2'; $client = \Zend\GData\ClientLogin::getHttpClient($user, $pass, $service); $this->photos = new Photos\Photos($client); }
public function setUp() { if (!constant('TESTS_ZEND_GDATA_ONLINE_ENABLED')) { $this->markTestSkipped('Zend_GData online tests are not enabled'); } $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $service = Calendar::AUTH_SERVICE_NAME; $client = \Zend\GData\ClientLogin::getHttpClient($user, $pass, $service); $this->gdata = new Calendar($client); }
public function setUp() { if (!constant('TESTS_ZEND_GDATA_ONLINE_ENABLED')) { $this->markTestSkipped('Zend_GData online tests are not enabled'); } $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $this->sprKey = constant('TESTS_ZEND_GDATA_SPREADSHEETS_SPREADSHEETKEY'); $this->wksId = constant('TESTS_ZEND_GDATA_SPREADSHEETS_WORKSHEETID'); $service = Spreadsheets\Spreadsheets::AUTH_SERVICE_NAME; $client = \Zend\GData\ClientLogin::getHttpClient($user, $pass, $service); $this->gdata = new Spreadsheets\Spreadsheets($client); }
public function testCommentOnAComment() { $developerKey = constant('TESTS_ZEND_GDATA_YOUTUBE_DEVELOPER_KEY'); $clientId = constant('TESTS_ZEND_GDATA_YOUTUBE_CLIENT_ID'); $client = GData\ClientLogin::getHttpClient( $this->user, $this->pass, 'youtube' , null, 'ZF_UnitTest', null, null, 'https://www.google.com/youtube/accounts/ClientLogin'); $youtube = new YouTube($client, 'ZF_UnitTest', $clientId, $developerKey); $youtube->setMajorProtocolVersion(2); $mostDiscussedFeed = $youtube->getVideoFeed( 'http://gdata.youtube.com/feeds/api/standardfeeds/most_discussed'); // get first entry $mostDiscussedFeed->rewind(); $firstEntry = $mostDiscussedFeed->current(); $this->assertTrue($firstEntry instanceof YouTube\VideoEntry); $commentFeed = $youtube->getVideoCommentFeed($firstEntry->getVideoId()); // get first comment $commentFeed->rewind(); $firstCommentEntry = $commentFeed->current(); $commentedComment = $youtube->replyToCommentEntry($firstCommentEntry, 'awesome ! (ZFUnitTest-test)'); $this->assertTrue( $commentedComment instanceof YouTube\CommentEntry); }
function testRetrieveNextFeedAndPreviousFeedsFromFeed() { $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $this->blog = constant('TESTS_ZEND_GDATA_BLOG_ID'); $service = 'youtube'; $client = GData\ClientLogin::getHttpClient($user, $pass, $service); $gd = new GData\GData($client); $feed = $gd->getFeed('http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured', '\\Zend\\GData\\App\\Feed'); $nextFeed = $feed->getNextFeed(); $this->assertNotNull($nextFeed); $this->assertTrue($nextFeed instanceof App\Feed); $this->assertEquals($nextFeed->count(), 25); $previousFeed = $nextFeed->getPreviousFeed(); $this->assertNotNull($previousFeed); $this->assertTrue($previousFeed instanceof App\Feed); $this->assertEquals($previousFeed->count(), 25); }