Example #1
0
 public function testConvertCommentEntryToAndFromString()
 {
     $this->entry->transferFromXML($this->entryText);
     $entryXml = $this->entry->saveXML();
     $newCommentEntry = new YouTube\CommentEntry();
     $newCommentEntry->transferFromXML($entryXml);
     $this->verifyAllSamplePropertiesAreCorrect($newCommentEntry);
     $newCommentEntryXml = $newCommentEntry->saveXML();
     $this->assertEquals($entryXml, $newCommentEntryXml);
 }
Example #2
0
 /**
  * Post a comment in reply to an existing comment
  *
  * @param YouTube\CommentEntry $commentEntry The comment entry
  *        to reply to
  * @param string $commentText The text of the comment to post
  * @return YouTube\CommentEntry the posted comment
  */
 public function replyToCommentEntry(YouTube\CommentEntry $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, '\\ZendGData\\YouTube\\CommentEntry');
 }