Skip to content

Commit 2d01fac

Browse files
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
1 parent 1a89e63 commit 2d01fac

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

tests/phpunit/tests/db.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ function test_prepare_sprintf() {
379379

380380
/**
381381
* @expectedIncorrectUsage wpdb::prepare
382+
* @requires PHP < 8.0
382383
*/
383384
function test_prepare_sprintf_invalid_args() {
384385
global $wpdb;
@@ -401,6 +402,7 @@ function test_prepare_vsprintf() {
401402

402403
/**
403404
* @expectedIncorrectUsage wpdb::prepare
405+
* @requires PHP < 8.0
404406
*/
405407
function test_prepare_vsprintf_invalid_args() {
406408
global $wpdb;
@@ -418,6 +420,7 @@ function test_prepare_vsprintf_invalid_args() {
418420
* @ticket 42040
419421
* @dataProvider data_prepare_incorrect_arg_count
420422
* @expectedIncorrectUsage wpdb::prepare
423+
* @requires PHP < 8.0
421424
*/
422425
public function test_prepare_incorrect_arg_count( $query, $args, $expected ) {
423426
global $wpdb;

0 commit comments

Comments
 (0)