Make WordPress Core

Changeset 35192


Ignore:
Timestamp:
10/15/2015 05:56:47 AM (11 years ago)
Author:
wonderboymusic
Message:

Unit Tests: in Tests_Comment_Query::test_get_comments_for_post(), create fewer comments (5, instead of 10).

See #30017, #33968.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/query.php

    r34599 r35192  
    536536
    537537        function test_get_comments_for_post() {
     538                $limit = 5;
     539
    538540                $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 );
    540542                $comments = get_comments( array( 'post_id' => $post_id ) );
    541                 $this->assertEquals( 10, count( $comments ) );
     543                $this->assertEquals( $limit, count( $comments ) );
    542544                foreach ( $comments as $comment ) {
    543545                        $this->assertEquals( $post_id, $comment->comment_post_ID );
     
    545547
    546548                $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 );
    548550                $comments = get_comments( array( 'post_id' => $post_id2 ) );
    549                 $this->assertEquals( 10, count( $comments ) );
     551                $this->assertEquals( $limit, count( $comments ) );
    550552                foreach ( $comments as $comment ) {
    551553                        $this->assertEquals( $post_id2, $comment->comment_post_ID );
     
    553555
    554556                $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' ) );
    556558                $comments = get_comments( array( 'post_id' => $post_id3 ) );
    557                 $this->assertEquals( 10, count( $comments ) );
     559                $this->assertEquals( $limit, count( $comments ) );
    558560                foreach ( $comments as $comment ) {
    559561                        $this->assertEquals( $post_id3, $comment->comment_post_ID );
     
    561563
    562564                $comments = get_comments( array( 'post_id' => $post_id3, 'status' => 'hold' ) );
    563                 $this->assertEquals( 10, count( $comments ) );
     565                $this->assertEquals( $limit, count( $comments ) );
    564566                foreach ( $comments as $comment ) {
    565567                        $this->assertEquals( $post_id3, $comment->comment_post_ID );
     
    569571                $this->assertEquals( 0, count( $comments ) );
    570572
    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' ) );
    572574                $comments = get_comments( array( 'post_id' => $post_id3 ) );
    573                 $this->assertEquals( 20, count( $comments ) );
     575                $this->assertEquals( $limit * 2, count( $comments ) );
    574576                foreach ( $comments as $comment ) {
    575577                        $this->assertEquals( $post_id3, $comment->comment_post_ID );
Note: See TracChangeset for help on using the changeset viewer.