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:
Andrew Nacin
2014-02-02 21:46:07 +00:00
parent 0558df56ce
commit 435df55864
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -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 );
}
}