Make WordPress Core

Ticket #24826: tests-comment-query.php.patch

File tests-comment-query.php.patch, 1.1 KB (added by westonruter, 12 years ago)
  • tests/comment/query.php

     
    153153                $this->assertEquals( 10, count( get_comments( array( 'status' => 'trash' ) ) ) );
    154154                $this->assertEquals( 10, count( get_comments( array( 'status' => 'spam' ) ) ) );
    155155        }
     156
     157        /**
     158         * Ticket 24826
     159         */
     160        function test_comment_query_object() {
     161                $comment_id = $this->factory->comment->create();
     162
     163                $query1 = new WP_Comment_Query();
     164                $this->assertNull( $query1->query_vars );
     165                $this->assertEmpty( $query1->comments );
     166                $comments = $query1->query( array( 'status' => 'all' ) );
     167                $this->assertInternalType( 'array', $query1->query_vars );
     168                $this->assertNotEmpty( $query1->comments );
     169                $this->assertInternalType( 'array', $query1->comments );
     170
     171                $query2 = new WP_Comment_Query( array( 'status' => 'all' ) );
     172                $this->assertNotEmpty( $query2->query_vars );
     173                $this->assertNotEmpty( $query2->comments );
     174                $this->assertEquals( $query2->comments, $query1->get_comments() );
     175        }
    156176}