Changeset 34713
- Timestamp:
- 09/30/2015 03:06:22 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/commentsTemplate.php
r34669 r34713 16 16 'comment_post_ID' => $p, 17 17 'comment_content' => '1', 18 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),19 ) ); 20 $comment_2 = $this->factory->comment->create( array( 21 'comment_post_ID' => $p, 22 'comment_content' => '2', 23 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),18 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 19 ) ); 20 $comment_2 = $this->factory->comment->create( array( 21 'comment_post_ID' => $p, 22 'comment_content' => '2', 23 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 24 24 ) ); 25 25 … … 34 34 35 35 $found_cids = array_map( 'intval', $matches[1] ); 36 $this->assertSame( array( $comment_ 1, $comment_2), $found_cids );36 $this->assertSame( array( $comment_2, $comment_1 ), $found_cids ); 37 37 } 38 38 … … 46 46 'comment_post_ID' => $p, 47 47 'comment_content' => '1', 48 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),49 ) ); 50 $comment_2 = $this->factory->comment->create( array( 51 'comment_post_ID' => $p, 52 'comment_content' => '2', 53 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),48 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 49 ) ); 50 $comment_2 = $this->factory->comment->create( array( 51 'comment_post_ID' => $p, 52 'comment_content' => '2', 53 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 54 54 ) ); 55 55 … … 64 64 65 65 $found_cids = array_map( 'intval', $matches[1] ); 66 $this->assertSame( array( $comment_ 2, $comment_1), $found_cids );66 $this->assertSame( array( $comment_1, $comment_2 ), $found_cids ); 67 67 } 68 68 … … 76 76 'comment_post_ID' => $p, 77 77 'comment_content' => '1', 78 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),79 ) ); 80 $comment_2 = $this->factory->comment->create( array( 81 'comment_post_ID' => $p, 82 'comment_content' => '2', 83 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),78 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 79 ) ); 80 $comment_2 = $this->factory->comment->create( array( 81 'comment_post_ID' => $p, 82 'comment_content' => '2', 83 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 84 84 ) ); 85 85 … … 94 94 95 95 $found_cids = array_map( 'intval', $matches[1] ); 96 $this->assertSame( array( $comment_ 1, $comment_2), $found_cids );96 $this->assertSame( array( $comment_2, $comment_1 ), $found_cids ); 97 97 } 98 98 … … 106 106 'comment_post_ID' => $p, 107 107 'comment_content' => '1', 108 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),109 ) ); 110 $comment_2 = $this->factory->comment->create( array( 111 'comment_post_ID' => $p, 112 'comment_content' => '2', 113 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),108 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 109 ) ); 110 $comment_2 = $this->factory->comment->create( array( 111 'comment_post_ID' => $p, 112 'comment_content' => '2', 113 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 114 114 ) ); 115 115 … … 124 124 125 125 $found_cids = array_map( 'intval', $matches[1] ); 126 $this->assertSame( array( $comment_ 2, $comment_1), $found_cids );126 $this->assertSame( array( $comment_1, $comment_2 ), $found_cids ); 127 127 } 128 128 … … 136 136 'comment_post_ID' => $p, 137 137 'comment_content' => '1', 138 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),139 ) ); 140 $comment_2 = $this->factory->comment->create( array( 141 'comment_post_ID' => $p, 142 'comment_content' => '2', 143 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),138 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 139 ) ); 140 $comment_2 = $this->factory->comment->create( array( 141 'comment_post_ID' => $p, 142 'comment_content' => '2', 143 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 144 144 ) ); 145 145 $comment_3 = $this->factory->comment->create( array( 146 146 'comment_post_ID' => $p, 147 147 'comment_content' => '3', 148 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),148 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), 149 149 ) ); 150 150 $comment_4 = $this->factory->comment->create( array( 151 151 'comment_post_ID' => $p, 152 152 'comment_content' => '4', 153 'comment_post_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 153 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 154 ) ); 155 $comment_5 = $this->factory->comment->create( array( 156 'comment_post_ID' => $p, 157 'comment_content' => '3', 158 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), 159 ) ); 160 $comment_6 = $this->factory->comment->create( array( 161 'comment_post_ID' => $p, 162 'comment_content' => '4', 163 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ), 154 164 ) ); 155 165 … … 157 167 update_option( 'default_comments_page', 'newest' ); 158 168 159 $this->go_to( get_permalink( $p ) . '?cpage=2&comments_per_page=2' ); 160 $found = get_echo( 'comments_template' ); 161 162 // Life in the fast lane. 163 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 164 165 $found_cids = array_map( 'intval', $matches[1] ); 166 $this->assertSame( array( $comment_3, $comment_4 ), $found_cids ); 169 $link = add_query_arg( array( 170 'cpage' => 2, 171 'comments_per_page' => 2, 172 ), get_permalink( $p ) ); 173 174 $this->go_to( $link ); 175 $found = get_echo( 'comments_template' ); 176 177 // Life in the fast lane. 178 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 179 180 $found_cids = array_map( 'intval', $matches[1] ); 181 $this->assertSame( array( $comment_4, $comment_3 ), $found_cids ); 167 182 } 168 183 … … 176 191 'comment_post_ID' => $p, 177 192 'comment_content' => '1', 178 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),179 ) ); 180 $comment_2 = $this->factory->comment->create( array( 181 'comment_post_ID' => $p, 182 'comment_content' => '2', 183 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),193 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 194 ) ); 195 $comment_2 = $this->factory->comment->create( array( 196 'comment_post_ID' => $p, 197 'comment_content' => '2', 198 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 184 199 ) ); 185 200 $comment_3 = $this->factory->comment->create( array( 186 201 'comment_post_ID' => $p, 187 202 'comment_content' => '3', 188 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),203 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), 189 204 ) ); 190 205 $comment_4 = $this->factory->comment->create( array( 191 206 'comment_post_ID' => $p, 192 207 'comment_content' => '4', 193 'comment_post_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 208 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 209 ) ); 210 $comment_5 = $this->factory->comment->create( array( 211 'comment_post_ID' => $p, 212 'comment_content' => '3', 213 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 500 ), 214 ) ); 215 $comment_6 = $this->factory->comment->create( array( 216 'comment_post_ID' => $p, 217 'comment_content' => '4', 218 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 600 ), 194 219 ) ); 195 220 … … 197 222 update_option( 'default_comments_page', 'newest' ); 198 223 199 $this->go_to( get_permalink( $p ) . '?cpage=2&comments_per_page=2' ); 200 $found = get_echo( 'comments_template' ); 201 202 // Life in the fast lane. 203 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 204 205 $found_cids = array_map( 'intval', $matches[1] ); 206 $this->assertSame( array( $comment_4, $comment_3 ), $found_cids ); 224 $link = add_query_arg( array( 225 'cpage' => 2, 226 'comments_per_page' => 2, 227 ), get_permalink( $p ) ); 228 229 $this->go_to( $link ); 230 $found = get_echo( 'comments_template' ); 231 232 // Life in the fast lane. 233 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 234 235 $found_cids = array_map( 'intval', $matches[1] ); 236 $this->assertSame( array( $comment_3, $comment_4 ), $found_cids ); 207 237 } 208 238 … … 216 246 'comment_post_ID' => $p, 217 247 'comment_content' => '1', 218 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),219 ) ); 220 $comment_2 = $this->factory->comment->create( array( 221 'comment_post_ID' => $p, 222 'comment_content' => '2', 223 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),248 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 249 ) ); 250 $comment_2 = $this->factory->comment->create( array( 251 'comment_post_ID' => $p, 252 'comment_content' => '2', 253 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 224 254 ) ); 225 255 $comment_3 = $this->factory->comment->create( array( 226 256 'comment_post_ID' => $p, 227 257 'comment_content' => '3', 228 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),258 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), 229 259 ) ); 230 260 $comment_4 = $this->factory->comment->create( array( 231 261 'comment_post_ID' => $p, 232 262 'comment_content' => '4', 233 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),263 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 234 264 ) ); 235 265 … … 237 267 update_option( 'default_comments_page', 'oldest' ); 238 268 239 $this->go_to( get_permalink( $p ) . '?cpage=2&comments_per_page=2' ); 240 $found = get_echo( 'comments_template' ); 241 242 // Life in the fast lane. 243 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 244 245 $found_cids = array_map( 'intval', $matches[1] ); 246 $this->assertSame( array( $comment_1, $comment_2 ), $found_cids ); 269 $link = add_query_arg( array( 270 'cpage' => 2, 271 'comments_per_page' => 2, 272 ), get_permalink( $p ) ); 273 274 $this->go_to( $link ); 275 $found = get_echo( 'comments_template' ); 276 277 // Life in the fast lane. 278 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 279 280 $found_cids = array_map( 'intval', $matches[1] ); 281 $this->assertSame( array( $comment_2, $comment_1 ), $found_cids ); 247 282 } 248 283 … … 256 291 'comment_post_ID' => $p, 257 292 'comment_content' => '1', 258 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 100 ),259 ) ); 260 $comment_2 = $this->factory->comment->create( array( 261 'comment_post_ID' => $p, 262 'comment_content' => '2', 263 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 200 ),293 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 294 ) ); 295 $comment_2 = $this->factory->comment->create( array( 296 'comment_post_ID' => $p, 297 'comment_content' => '2', 298 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 264 299 ) ); 265 300 $comment_3 = $this->factory->comment->create( array( 266 301 'comment_post_ID' => $p, 267 302 'comment_content' => '3', 268 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 300 ),303 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), 269 304 ) ); 270 305 $comment_4 = $this->factory->comment->create( array( 271 306 'comment_post_ID' => $p, 272 307 'comment_content' => '4', 273 'comment_ post_gmt' => date( 'Y-m-d H:i:s', $now - 400 ),308 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 400 ), 274 309 ) ); 275 310 … … 277 312 update_option( 'default_comments_page', 'oldest' ); 278 313 279 $this->go_to( get_permalink( $p ) . '?cpage=2&comments_per_page=2' ); 280 $found = get_echo( 'comments_template' ); 281 282 // Life in the fast lane. 283 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 284 285 $found_cids = array_map( 'intval', $matches[1] ); 286 $this->assertSame( array( $comment_2, $comment_1 ), $found_cids ); 314 $link = add_query_arg( array( 315 'cpage' => 2, 316 'comments_per_page' => 2, 317 ), get_permalink( $p ) ); 318 319 $this->go_to( $link ); 320 $found = get_echo( 'comments_template' ); 321 322 // Life in the fast lane. 323 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 324 325 $found_cids = array_map( 'intval', $matches[1] ); 326 $this->assertSame( array( $comment_1, $comment_2 ), $found_cids ); 287 327 } 288 328 }
Note: See TracChangeset
for help on using the changeset viewer.