/** * Output the reply's ancestor reply id * * @since bbPress (r4944) * * @param int $reply_id Optional. Reply id * @uses bbp_get_reply_ancestor_id() To get the reply's ancestor id */ function bbp_reply_ancestor_id($reply_id = 0) { echo bbp_get_reply_ancestor_id($reply_id); }
/** * @covers ::bbp_reply_ancestor_id * @covers ::bbp_get_reply_ancestor_id */ public function test_bbp_get_reply_ancestor_id() { $f = $this->factory->forum->create(); $t = $this->factory->topic->create(array('post_parent' => $f, 'topic_meta' => array('forum_id' => $f))); $r1 = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t))); $r2 = $this->factory->reply->create(array('post_parent' => $t, 'reply_meta' => array('forum_id' => $f, 'topic_id' => $t, 'reply_to' => $r1))); $reply_ancestor_id = bbp_get_reply_ancestor_id($r2); $this->assertSame($r1, $reply_ancestor_id); }