Make WordPress Core


Ignore:
Timestamp:
01/26/2016 02:55:15 AM (10 years ago)
Author:
boonebgorges
Message:

Introduce $comment_status and $ping_status params for WP_Query.

Props birgire.
Fixes #35601.

File:
1 edited

Legend:

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

    r35242 r36403  
    493493        $this->assertContains( 'LIMIT 5, 5', $q->request );
    494494    }
     495
     496    /**
     497     * @ticket 35601
     498     */
     499    public function test_comment_status() {
     500        $p1 = self::factory()->post->create( array( 'comment_status' => 'open' ) );
     501        $p2 = self::factory()->post->create( array( 'comment_status' => 'closed' ) );
     502
     503        $q = new WP_Query( array(
     504            'fields' => 'ids',
     505            'comment_status' => 'closed',
     506        ) );
     507
     508        $this->assertSame( array( $p2 ), $q->posts );
     509    }
     510
     511    /**
     512     * @ticket 35601
     513     */
     514    public function test_ping_status() {
     515        $p1 = self::factory()->post->create( array( 'ping_status' => 'open' ) );
     516        $p2 = self::factory()->post->create( array( 'ping_status' => 'closed' ) );
     517
     518        $q = new WP_Query( array(
     519            'fields' => 'ids',
     520            'ping_status' => 'closed',
     521        ) );
     522
     523        $this->assertSame( array( $p2 ), $q->posts );
     524    }
    495525}
Note: See TracChangeset for help on using the changeset viewer.