コード例 #1
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($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);
    }