Tests: Correct assertion in Tests_DB::test_prepare_incorrect_arg_count().

On failure, `wpdb::prepare()` returns either an empty string or `null`, not `false`.

The test only passed accidentally due to `assertEquals()` not performing a strict type check.

Follow-up to [41662].

See #38266.

git-svn-id: https://develop.svn.wordpress.org/trunk@48974 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-09-13 15:19:40 +00:00
parent 2d01fac875
commit 91feaf04af

View File

@ -427,7 +427,7 @@ class Tests_DB extends WP_UnitTestCase {
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.DB.PreparedSQL // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.DB.PreparedSQL
$prepared = @$wpdb->prepare( $query, ...$args ); $prepared = @$wpdb->prepare( $query, ...$args );
$this->assertEquals( $expected, $prepared ); $this->assertSame( $expected, $prepared );
} }
public function data_prepare_incorrect_arg_count() { public function data_prepare_incorrect_arg_count() {
@ -442,7 +442,7 @@ class Tests_DB extends WP_UnitTestCase {
array( array(
"SELECT * FROM $wpdb->users WHERE id = %%%d AND user_login = %s", "SELECT * FROM $wpdb->users WHERE id = %%%d AND user_login = %s",
array( 1 ), array( 1 ),
false, '',
), ),
array( array(
"SELECT * FROM $wpdb->users WHERE id = %d AND user_login = %s", "SELECT * FROM $wpdb->users WHERE id = %d AND user_login = %s",