From 91feaf04afc4b07ffc2bd3996a300ee880995351 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 13 Sep 2020 15:19:40 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/db.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index ac807d006a..206d1f196b 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -427,7 +427,7 @@ class Tests_DB extends WP_UnitTestCase { // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.DB.PreparedSQL $prepared = @$wpdb->prepare( $query, ...$args ); - $this->assertEquals( $expected, $prepared ); + $this->assertSame( $expected, $prepared ); } public function data_prepare_incorrect_arg_count() { @@ -442,7 +442,7 @@ class Tests_DB extends WP_UnitTestCase { array( "SELECT * FROM $wpdb->users WHERE id = %%%d AND user_login = %s", array( 1 ), - false, + '', ), array( "SELECT * FROM $wpdb->users WHERE id = %d AND user_login = %s",