Changeset 35192
- Timestamp:
- 10/15/2015 05:56:47 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/comment/query.php
r34599 r35192 536 536 537 537 function test_get_comments_for_post() { 538 $limit = 5; 539 538 540 $post_id = $this->factory->post->create(); 539 $this->factory->comment->create_post_comments( $post_id, 10);541 $this->factory->comment->create_post_comments( $post_id, $limit ); 540 542 $comments = get_comments( array( 'post_id' => $post_id ) ); 541 $this->assertEquals( 10, count( $comments ) );543 $this->assertEquals( $limit, count( $comments ) ); 542 544 foreach ( $comments as $comment ) { 543 545 $this->assertEquals( $post_id, $comment->comment_post_ID ); … … 545 547 546 548 $post_id2 = $this->factory->post->create(); 547 $this->factory->comment->create_post_comments( $post_id2, 10);549 $this->factory->comment->create_post_comments( $post_id2, $limit ); 548 550 $comments = get_comments( array( 'post_id' => $post_id2 ) ); 549 $this->assertEquals( 10, count( $comments ) );551 $this->assertEquals( $limit, count( $comments ) ); 550 552 foreach ( $comments as $comment ) { 551 553 $this->assertEquals( $post_id2, $comment->comment_post_ID ); … … 553 555 554 556 $post_id3 = $this->factory->post->create(); 555 $this->factory->comment->create_post_comments( $post_id3, 10, array( 'comment_approved' => '0' ) );557 $this->factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '0' ) ); 556 558 $comments = get_comments( array( 'post_id' => $post_id3 ) ); 557 $this->assertEquals( 10, count( $comments ) );559 $this->assertEquals( $limit, count( $comments ) ); 558 560 foreach ( $comments as $comment ) { 559 561 $this->assertEquals( $post_id3, $comment->comment_post_ID ); … … 561 563 562 564 $comments = get_comments( array( 'post_id' => $post_id3, 'status' => 'hold' ) ); 563 $this->assertEquals( 10, count( $comments ) );565 $this->assertEquals( $limit, count( $comments ) ); 564 566 foreach ( $comments as $comment ) { 565 567 $this->assertEquals( $post_id3, $comment->comment_post_ID ); … … 569 571 $this->assertEquals( 0, count( $comments ) ); 570 572 571 $this->factory->comment->create_post_comments( $post_id3, 10, array( 'comment_approved' => '1' ) );573 $this->factory->comment->create_post_comments( $post_id3, $limit, array( 'comment_approved' => '1' ) ); 572 574 $comments = get_comments( array( 'post_id' => $post_id3 ) ); 573 $this->assertEquals( 20, count( $comments ) );575 $this->assertEquals( $limit * 2, count( $comments ) ); 574 576 foreach ( $comments as $comment ) { 575 577 $this->assertEquals( $post_id3, $comment->comment_post_ID );
Note: See TracChangeset
for help on using the changeset viewer.