Exemple #1
0
 /**
  * Post a comment in reply to an existing comment
  *
  * @param Zend_Gdata_YouTube_CommentEntry $commentEntry The comment entry
  *         to reply to
  * @param string                          $commentText  The text of the
  *         comment to post
  * @return Zend_Gdata_YouTube_CommentEntry the posted comment
  */
 public function replyToCommentEntry($commentEntry, $commentText)
 {
     $newComment = $this->newCommentEntry();
     $newComment->content = $this->newContent()->setText($commentText);
     $commentId = $commentEntry->getId();
     $commentIdArray = explode(':', $commentId);
     // create a new link element
     $inReplyToLinkHref = self::VIDEO_URI . '/' . $commentIdArray[3] . '/comments/' . $commentIdArray[5];
     $inReplyToLink = $this->newLink($inReplyToLinkHref, self::IN_REPLY_TO_SCHEME, $type = "application/atom+xml");
     $links = $newComment->getLink();
     $links[] = $inReplyToLink;
     $newComment->setLink($links);
     $commentFeedPostUrl = self::VIDEO_URI . '/' . $commentIdArray[3] . '/comments';
     return $this->insertEntry($newComment, $commentFeedPostUrl, 'Zend_Gdata_YouTube_CommentEntry');
 }
 public function testConvertCommentEntryToAndFromString()
 {
     $this->entry->transferFromXML($this->entryText);
     $entryXml = $this->entry->saveXML();
     $newCommentEntry = new Zend_Gdata_YouTube_CommentEntry();
     $newCommentEntry->transferFromXML($entryXml);
     $this->verifyAllSamplePropertiesAreCorrect($newCommentEntry);
     $newCommentEntryXml = $newCommentEntry->saveXML();
     $this->assertEquals($entryXml, $newCommentEntryXml);
 }