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);
    }
Beispiel #2
0
 /**
  * test related to ZF2-303
  */
 public function testQueryWithGetFeed()
 {
     if (!constant('TESTS_ZEND_GDATA_ONLINE_ENABLED')) {
         $this->markTestSkipped('Zend_GData 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);
 }