public function testSetClientIDAndDeveloperKeyHeader() { $applicationId = 'MyTestCompany-MyTestApp-0.1'; $clientId = 'MyClientId'; $developerKey = 'MyDeveloperKey'; $httpClient = new \Zend\Http\Client(); $yt = new YouTube($httpClient, $applicationId, $clientId, $developerKey); $this->assertTrue($yt instanceof YouTube); $client = $yt->getHttpClient(); $this->assertEquals($client->getHeader('User-Agent'), \ZendGData\App::getUserAgentString($applicationId)); $this->assertEquals($client->getHeader('X-GData-Key'), 'key=' . $developerKey); $this->assertEquals($client->getHeader('X-GData-Client'), $clientId); }
/** * test related to ZF2-303 */ public function testQueryWithGetFeed() { if (!constant('TESTS_ZEND_GDATA_ONLINE_ENABLED')) { $this->markTestSkipped('ZendGData online tests are not enabled'); } $youtube = new YouTube(); $query = $youtube->newVideoQuery(); $query->videoQuery = 'php'; $query->startIndex = 0; $query->maxResults = 20; $query->orderBy = 'viewCount'; $videoFeed = $youtube->getVideoFeed($query); $this->assertTrue($videoFeed->count() > 10); }
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); }