From 2d01fac875ba8549d7300ff32cb383c779777148 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 13 Sep 2020 02:47:20 +0000 Subject: [PATCH] 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 --- tests/phpunit/tests/db.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/phpunit/tests/db.php b/tests/phpunit/tests/db.php index a715ba822c..ac807d006a 100644 --- a/tests/phpunit/tests/db.php +++ b/tests/phpunit/tests/db.php @@ -379,6 +379,7 @@ class Tests_DB extends WP_UnitTestCase { /** * @expectedIncorrectUsage wpdb::prepare + * @requires PHP < 8.0 */ function test_prepare_sprintf_invalid_args() { global $wpdb; @@ -401,6 +402,7 @@ class Tests_DB extends WP_UnitTestCase { /** * @expectedIncorrectUsage wpdb::prepare + * @requires PHP < 8.0 */ function test_prepare_vsprintf_invalid_args() { global $wpdb; @@ -418,6 +420,7 @@ 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;