function CommentNotifyTestCase::commentExists in Comment Notify 6
Same name and namespace in other branches
- 7 comment_notify.test \CommentNotifyTestCase::commentExists()
Checks current page for specified comment.
Parameters
object $comment Comment object.:
boolean $reply The comment is a reply to another comment.:
Return value
boolean Comment found.
File
- ./
comment_notify.test, line 171
Class
Code
function commentExists($comment, $reply = FALSE) {
if ($comment && is_object($comment)) {
$regex = '/' . ($reply ? '<div class="indented">(.*?)' : '');
$regex .= '<a id="comment-' . $comment->id . '"(.*?)';
// Comment anchor.
$regex .= '<div(.*?)';
// Begin in comment div.
$regex .= $comment->subject . '(.*?)';
// Match subject.
$regex .= $comment->comment . '(.*?)';
// Match comment.
$regex .= '<\\/div>/s';
// Dot matches newlines and ensure that match doesn't bleed outside comment div.
return (bool) preg_match($regex, $this
->drupalGetContent());
}
else {
return FALSE;
}
}