mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
In get_bookmarks(), don't cache if 'orderby=rand'.
Props lukecavanagh, prettyboymp, c3mdigital, MikeHansenMe. Fixes #18356. git-svn-id: https://develop.svn.wordpress.org/trunk@37565 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -47,4 +47,27 @@ class Tests_Bookmark_GetBookmarks extends WP_UnitTestCase {
|
||||
$this->assertEqualSets( $bookmarks, wp_list_pluck( $found2, 'link_id' ) );
|
||||
$this->assertTrue( $num_queries < $wpdb->num_queries );
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 18356
|
||||
*/
|
||||
public function test_orderby_rand_should_not_be_cached() {
|
||||
global $wpdb;
|
||||
|
||||
$bookmarks = self::factory()->bookmark->create_many( 2 );
|
||||
|
||||
$found1 = get_bookmarks( array(
|
||||
'orderby' => 'rand',
|
||||
) );
|
||||
|
||||
$num_queries = $wpdb->num_queries;
|
||||
|
||||
$found2 = get_bookmarks( array(
|
||||
'orderby' => 'rand',
|
||||
) );
|
||||
|
||||
// equal sets != same order
|
||||
$this->assertEqualSets( $found1, $found2 );
|
||||
$this->assertTrue( $num_queries < $wpdb->num_queries );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user