mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 20:30:23 +00:00
Throw an incorrect usage notice when the query argument of wpdb::prepare() does not include a placeholder.
props ounziw. fixes #25604. git-svn-id: https://develop.svn.wordpress.org/trunk@27073 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -193,4 +193,16 @@ class Tests_DB extends WP_UnitTestCase {
|
||||
unset( $modes[ $pos ] );
|
||||
return $modes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ticket 25604
|
||||
* @expectedIncorrectUsage wpdb::prepare
|
||||
*/
|
||||
function test_prepare_without_arguments() {
|
||||
global $wpdb;
|
||||
$id = 0;
|
||||
// This, obviously, is an incorrect prepare.
|
||||
$prepared = $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE id = $id", $id );
|
||||
$this->assertEquals( "SELECT * FROM $wpdb->users WHERE id = 0", $prepared );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user