Asserts that the link to the specified parent comment is present.
@parm int $cid The comment ID to check.
int $pid: The expected parent comment ID.
protected function assertParentLink($cid, $pid) {
// This pattern matches a markup structure like:
// <a id="comment-2"></a>
// <article>
// <p class="parent">
// <a href="...comment-1"></a>
// </p>
// </article>
$pattern = "//a[@id='comment-{$cid}']/following-sibling::article//p[contains(@class, 'parent')]//a[contains(@href, 'comment-{$pid}')]";
$this
->assertFieldByXpath($pattern, NULL, format_string('Comment %cid has a link to parent %pid.', array(
'%cid' => $cid,
'%pid' => $pid,
)));
}