Tests: Revert [48973].

These tests ensure that a `_doing_it_wrong()` notice is thrown when `wpdb::prepare()` is called incorrectly, but also that the function will still handle the provided input as correctly as possible.

Disabling these tests on PHP 8 hides a problem, i.e. the function will no longer throw a notice and handle things correctly, it will now cause a white screen of death due to a fatal error.

That is a backward compatibility break, and `wpdb::prepare()` should be updated instead to maintain the original behaviour on PHP 8.

Props jrf, ayeshrajans.
See #50913, #50639.

git-svn-id: https://develop.svn.wordpress.org/trunk@48979 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-09-16 01:33:42 +00:00
parent b936a4131d
commit aadc1d70f2

View File

@ -379,7 +379,6 @@ class Tests_DB extends WP_UnitTestCase {
/**
* @expectedIncorrectUsage wpdb::prepare
* @requires PHP < 8.0
*/
function test_prepare_sprintf_invalid_args() {
global $wpdb;
@ -402,7 +401,6 @@ class Tests_DB extends WP_UnitTestCase {
/**
* @expectedIncorrectUsage wpdb::prepare
* @requires PHP < 8.0
*/
function test_prepare_vsprintf_invalid_args() {
global $wpdb;
@ -420,7 +418,6 @@ class Tests_DB extends WP_UnitTestCase {
* @ticket 42040
* @dataProvider data_prepare_incorrect_arg_count
* @expectedIncorrectUsage wpdb::prepare
* @requires PHP < 8.0
*/
public function test_prepare_incorrect_arg_count( $query, $args, $expected ) {
global $wpdb;