- Timestamp:
- 01/20/2016 05:23:02 AM (9 years ago)
- Location:
- branches/4.4
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/4.4
-
branches/4.4/tests/phpunit/tests/comment/wpListComments.php
r36158 r36356 111 111 $this->assertSame( array( $comments[1], $comments[0] ), array_map( 'intval', $matches[1] ) ); 112 112 } 113 114 /** 115 * @ticket 35356 116 * @ticket 35175 117 */ 118 public function test_comments_param_should_be_respected_when_custom_pagination_params_are_passed() { 119 $p = self::factory()->post->create(); 120 121 $comments = array(); 122 $now = time(); 123 for ( $i = 0; $i <= 5; $i++ ) { 124 $comments[] = self::factory()->comment->create( array( 125 'comment_post_ID' => $p, 126 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - $i ), 127 'comment_author' => 'Commenter ' . $i, 128 ) ); 129 } 130 131 update_option( 'page_comments', true ); 132 update_option( 'comments_per_page', 2 ); 133 134 $_comments = array( get_comment( $comments[1] ), get_comment( $comments[3] ) ); 135 136 // Populate `$wp_query->comments` in order to show that it doesn't override `$_comments`. 137 $this->go_to( get_permalink( $p ) ); 138 get_echo( 'comments_template' ); 139 140 $found = wp_list_comments( array( 141 'echo' => false, 142 'per_page' => 1, 143 'page' => 2, 144 ), $_comments ); 145 146 preg_match_all( '|id="comment\-([0-9]+)"|', $found, $matches ); 147 $this->assertSame( array( $comments[3] ), array_map( 'intval', $matches[1] ) ); 148 } 113 149 }
Note: See TracChangeset
for help on using the changeset viewer.