diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
index b10fe14..69dcc16 100644
|
|
|
function get_comment_reply_link( $args = array(), $comment = null, $post = null |
| 1646 | 1646 | |
| 1647 | 1647 | $comment = get_comment( $comment ); |
| 1648 | 1648 | |
| | 1649 | if ( empty( $comment ) ) { |
| | 1650 | return; |
| | 1651 | } |
| | 1652 | |
| 1649 | 1653 | if ( empty( $post ) ) { |
| 1650 | 1654 | $post = $comment->comment_post_ID; |
| 1651 | 1655 | } |
diff --git tests/phpunit/tests/comment/getCommentReplyLink.php tests/phpunit/tests/comment/getCommentReplyLink.php
index 5ca395e..73e2885 100644
|
|
|
class Tests_Comment_GetCommentReplyLink extends WP_UnitTestCase { |
| 66 | 66 | |
| 67 | 67 | $this->assertContains( $expected_url, $comment_reply_link ); |
| 68 | 68 | } |
| | 69 | |
| | 70 | /** |
| | 71 | * @ticket 41846 |
| | 72 | */ |
| | 73 | public function test_should_return_null_when_depth_less_than_max_depth_and_comment_null_and_no_current_global_comment() { |
| | 74 | |
| | 75 | // Let max depth be greater than depth and depth be non-zero. |
| | 76 | $args = array( |
| | 77 | 'depth' => 1, |
| | 78 | 'max_depth' => 2, |
| | 79 | ); |
| | 80 | |
| | 81 | // Make sure there's no global comment object. |
| | 82 | add_filter( 'get_comment', '__return_null' ); |
| | 83 | |
| | 84 | $actual = get_comment_reply_link( $args ); |
| | 85 | |
| | 86 | $this->assertNull( $actual ); |
| | 87 | } |
| | 88 | |
| 69 | 89 | } |