Make WordPress Core


Ignore:
Timestamp:
02/02/2014 07:35:54 AM (11 years ago)
Author:
wonderboymusic
Message:

Fix an error in SQL generation when perm is set and an array is passed for post_status. Adds unit test.

Props oso96_2000.
Fixes #25523.

File:
1 edited

Legend:

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

    r26479 r27067  
    534534        $this->assertFalse( $this->q->is_year );
    535535    }
     536
     537    function test_perm_with_status_array() {
     538        global $wpdb;
     539        $this->q->query( array( 'perm' => 'readable', 'post_status' => array( 'publish', 'private' ) ) );
     540        $this->assertTrue( $this->q->have_posts() );
     541        $this->assertContains( "(({$wpdb->posts}.post_status = 'publish') OR ({$wpdb->posts}.post_author = 0 AND ({$wpdb->posts}.post_status = 'private')))",
     542            $this->q->request
     543        );
     544        $this->assertNotContains( "({$wpdb->posts}.post_status = 'publish') AND", $this->q->request );
     545    }
    536546}
Note: See TracChangeset for help on using the changeset viewer.