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('X-GData-Key'), 'key=' . $developerKey); $this->assertEquals($client->getHeader('X-GData-Client'), $clientId); }
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); }
/** * @group ZF-8720 */ public function testQueryExclamationMarkRemoveBug() { $yt = new 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()); }
/** * 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); }