Make WordPress Core

Ticket #28434: 28434-tests.patch

File 28434-tests.patch, 1.1 KB (added by mordauk, 10 years ago)
  • tests/phpunit/tests/comment/query.php

     
    180180                $this->assertEquals( $users[1], $comments[2]->user_id );
    181181
    182182        }
     183
     184        function test_fields_query() {
     185               
     186                $comment_id1 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 7, 'comment_approved' => '1' ) );
     187                $comment_id2 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     188                $comment_id3 = $this->factory->comment->create( array( 'comment_post_ID' => $this->post_id, 'user_id' => 1, 'comment_approved' => '1' ) );
     189               
     190                $comments = get_comments( array( 'fields' => 'ids' ) );
     191                $this->assertEquals( 3, count( $comments ) );
     192
     193                $this->assertEquals( $comment_id1, $comment1->comment_ID );
     194                $this->assertEquals( $comment_id2, $comment2->comment_ID );
     195                $this->assertEquals( $comment_id3, $comment3->comment_ID );
     196
     197        }
    183198}