Tests: Require PHP less than 8.0 for some `wpdb` tests.

These tests ensure that `wpdb::prepare()` throws a `_doing_it_wrong()` notice when called with an incorrect number of arguments, or with arguments of a wrong type.

PHP 8 introduces similar error messages natively, making these tests redundant on PHP 8.0 or later.

Follow-up to [41470], [41662].

See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@48973 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-09-13 02:47:20 +00:00
parent 1a89e63838
commit 2d01fac875
1 changed files with 3 additions and 0 deletions

View File

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