Esempio n. 1
0
 public function testSetClientIDAndDeveloperKeyHeader()
 {
     $applicationId = 'MyTestCompany-MyTestApp-0.1';
     $clientId = 'MyClientId';
     $developerKey = 'MyDeveloperKey';
     $httpClient = new \Zend\HTTP\Client();
     $yt = new YouTube\YouTube($httpClient, $applicationId, $clientId, $developerKey);
     $this->assertTrue($yt instanceof YouTube\YouTube);
     $client = $yt->getHttpClient();
     $this->assertEquals($client->getHeader('X-GData-Key'), 'key=' . $developerKey);
     $this->assertEquals($client->getHeader('X-GData-Client'), $clientId);
 }
Esempio n. 2
0
 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\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);
 }
Esempio n. 3
0
 /**
  * @group ZF-8720
  */
 public function testQueryExclamationMarkRemoveBug()
 {
     $yt = new YouTube\YouTube();
     $query = $yt->newVideoQuery();
     $location = '37.42307,-122.08427';
     $this->assertNull($query->setLocation($location));
     $this->assertEquals($location, $query->getLocation());
     $location = '37.42307,-122.08427!';
     $this->assertNull($query->setLocation($location));
     $this->assertEquals($location, $query->getLocation());
 }