Make WordPress Core

Ticket #34946: 34946.diff

File 34946.diff, 1.2 KB (added by boonebgorges, 9 years ago)
  • src/wp-includes/comment-template.php

    diff --git src/wp-includes/comment-template.php src/wp-includes/comment-template.php
    index a972963..ad6e481 100644
    function get_comment_link( $comment = null, $args = array() ) { 
    736736                }
    737737        }
    738738
    739         if ( $cpage ) {
     739        if ( $cpage && get_option( 'page_comments' ) ) {
    740740                if ( $wp_rewrite->using_permalinks() ) {
    741741                        if ( $cpage ) {
    742742                                $link = trailingslashit( $link ) . $wp_rewrite->comments_pagination_base . '-' . $cpage;
  • tests/phpunit/tests/comment/getCommentLink.php

    diff --git tests/phpunit/tests/comment/getCommentLink.php tests/phpunit/tests/comment/getCommentLink.php
    index da3d96a..b74212a 100644
    class Tests_Comment_GetCommentLink extends WP_UnitTestCase { 
    128128
    129129                $this->assertContains( 'cpage=3', $found );
    130130        }
     131
     132        /**
     133         * @ticket 34946
     134         */
     135        public function test_should_not_contain_comment_page_1_when_pagination_is_disabled() {
     136                $this->set_permalink_structure( '/%postname%/' );
     137                update_option( 'page_comments', 0 );
     138
     139                $found = get_comment_link( self::$comments[1] );
     140
     141                $this->assertNotContains( 'comment-page-1', $found );
     142        }
    131143}