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 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('ZendGData 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 = \ZendGData\ClientLogin::getHttpClient($user, $pass, $service); $this->gdata = new Calendar($client); }
public function setUp() { if (!constant('TESTS_ZEND_GDATA_ONLINE_ENABLED')) { $this->markTestSkipped('ZendGData online tests are not enabled'); } $user = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_EMAIL'); $pass = constant('TESTS_ZEND_GDATA_CLIENTLOGIN_PASSWORD'); $service = 'lh2'; $client = \ZendGData\ClientLogin::getHttpClient($user, $pass, $service); $this->photos = new Photos($client); }
public function setUp() { if (!constant('TESTS_ZEND_GDATA_ONLINE_ENABLED')) { $this->markTestSkipped('ZendGData 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::AUTH_SERVICE_NAME; $client = \ZendGData\ClientLogin::getHttpClient($user, $pass, $service); $this->gdata = new Spreadsheets($client); }
<?php require_once './autoloader.php'; $loader->registerNamespace('ZendGData\\', EVA_PUBLIC_PATH . '/../vendor/ZendGdata/library/ZendGData'); $user = "******"; $pass = "******"; $userId = '104171418568283484752'; $albumId = '5819073682310479025'; $client = \ZendGData\ClientLogin::getHttpClient($user, $pass, \ZendGData\Photos::AUTH_SERVICE_NAME); $service = new \ZendGData\Photos($client); $fileSource = $service->newMediaFileSource('D:\\xampp\\htdocs\\zf2\\public/static/upload\\e7\\6a\\b4\\YrYN3m.gif'); $fileSource->setContentType('image/jpeg'); $fileSource->setSlug('test.jpg'); $entry = new \ZendGData\Photos\PhotoEntry(); $entry->setMediaSource($fileSource); $entry->setTitle($service->newTitle('test')); $albumQuery = new \ZendGData\Photos\AlbumQuery(); $albumQuery->setUser($userId); $albumQuery->setAlbumId($albumId); $albumEntry = $service->getAlbumEntry($albumQuery); try { $service->insertPhotoEntry($entry, $albumEntry->getEditLink()->getHref()); } catch (\Exception $e) { p($client); throw $e; }
public function testCommentOnAComment() { $developerKey = constant('TESTS_ZEND_GDATA_YOUTUBE_DEVELOPER_KEY'); $clientId = constant('TESTS_ZEND_GDATA_YOUTUBE_CLIENT_ID'); $client = 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('https://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); }
/** * * @return \ZendGData\HttpClient */ private function getGoogleClient() { $adapter = new \Zend\Http\Client\Adapter\Curl(); $adapter->setOptions(array('curloptions' => array(CURLOPT_SSL_VERIFYPEER => false))); $httpClient = new \ZendGData\HttpClient(); $httpClient->setAdapter($adapter); $client = \ZendGData\ClientLogin::getHttpClient(self::GOOGLE_USER_ID, self::GOOGLE_PASSWORD, \ZendGData\Photos::AUTH_SERVICE_NAME, $httpClient); return $client; }
public 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 = ClientLogin::getHttpClient($user, $pass, $service); $gd = new GData($client); $feed = $gd->getFeed('http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured', '\\ZendGData\\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); }