Exemplo n.º 1
0
 public function testThrowExceptionOnSendingMessageWithoutVideo()
 {
     $exceptionCaught = false;
     $this->gdata = new YouTube();
     try {
         $this->gdata->sendVideoMessage('Should fail', null, null, 'foo');
     } catch (App\InvalidArgumentException $e) {
         $exceptionCaught = true;
     }
     $this->assertTrue($exceptionCaught, 'Was expecting an exception if ' . 'sending a message without a video');
 }
Exemplo n.º 2
0
    public function testSendAMessageV1()
    {
        $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(1);

        // get a video from the recently featured video feed
        $videoFeed = $youtube->getRecentlyFeaturedVideoFeed();
        $videoEntry = $videoFeed->entry[0];
        $this->assertTrue($videoEntry instanceof YouTube\VideoEntry);

        // sending message to gdpython (python client library unit test user)
        $sentMessage = $youtube->sendVideoMessage(
            'Sending a v1 test message from Zend_GData_YouTubeOnlineTest.',
            $videoEntry, null, 'gdpython');
        $this->assertTrue(
            $sentMessage instanceof YouTube\InboxEntry);
    }