Changeset 34729 for trunk/tests/phpunit/tests/comment/commentsTemplate.php
- Timestamp:
- 10/01/2015 03:10:13 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/commentsTemplate.php
r34713 r34729 326 326 $this->assertSame( array( $comment_1, $comment_2 ), $found_cids ); 327 327 } 328 329 /** 330 * @ticket 8071 331 * @ticket 34073 332 * @ticket 29462 333 */ 334 public function test_last_page_of_comments_should_be_full_when_default_comment_page_is_newest() { 335 $now = time(); 336 $p = $this->factory->post->create(); 337 $comment_1 = $this->factory->comment->create( array( 338 'comment_post_ID' => $p, 339 'comment_content' => '1', 340 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 341 ) ); 342 $comment_2 = $this->factory->comment->create( array( 343 'comment_post_ID' => $p, 344 'comment_content' => '2', 345 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 346 ) ); 347 $comment_3 = $this->factory->comment->create( array( 348 'comment_post_ID' => $p, 349 'comment_content' => '3', 350 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), 351 ) ); 352 353 update_option( 'default_comments_page', 'newest' ); 354 update_option( 'comment_order', 'desc' ); 355 356 $link = add_query_arg( array( 357 'cpage' => 1, 358 'comments_per_page' => 2, 359 ), get_permalink( $p ) ); 360 361 $this->go_to( $link ); 362 $found = get_echo( 'comments_template' ); 363 364 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 365 366 $found_cids = array_map( 'intval', $matches[1] ); 367 368 $this->assertSame( array( $comment_2, $comment_3 ), $found_cids ); 369 } 370 371 /** 372 * @ticket 8071 373 * @ticket 34073 374 * @ticket 29462 375 */ 376 public function test_first_page_of_comments_should_have_remainder_when_default_comments_page_is_newest() { 377 $now = time(); 378 $p = $this->factory->post->create(); 379 $comment_1 = $this->factory->comment->create( array( 380 'comment_post_ID' => $p, 381 'comment_content' => '1', 382 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 100 ), 383 ) ); 384 $comment_2 = $this->factory->comment->create( array( 385 'comment_post_ID' => $p, 386 'comment_content' => '2', 387 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 200 ), 388 ) ); 389 $comment_3 = $this->factory->comment->create( array( 390 'comment_post_ID' => $p, 391 'comment_content' => '3', 392 'comment_date_gmt' => date( 'Y-m-d H:i:s', $now - 300 ), 393 ) ); 394 395 update_option( 'default_comments_page', 'newest' ); 396 update_option( 'comment_order', 'desc' ); 397 398 $link = add_query_arg( array( 399 'cpage' => 2, 400 'comments_per_page' => 2, 401 ), get_permalink( $p ) ); 402 403 $this->go_to( $link ); 404 $found = get_echo( 'comments_template' ); 405 406 $comments = preg_match_all( '/id="comment-([0-9]+)"/', $found, $matches ); 407 408 $found_cids = array_map( 'intval', $matches[1] ); 409 410 $this->assertSame( array( $comment_1 ), $found_cids ); 411 } 328 412 }
Note: See TracChangeset
for help on using the changeset viewer.