From 4e384e2067b15f33bc962c8586767dae2862ac12 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Thu, 21 Mar 2024 16:12:59 +0100 Subject: [PATCH] Update the `minimum_wp_version` to WP 6.2 The minimum version should be three versions behind the latest WP release, so what with 6.5 being in RC, to be released on next week, it should now become 6.2. Includes updating the tests to match. Previous: 2121, 2321 --- WordPress/Helpers/MinimumWPVersionTrait.php | 2 +- .../Tests/DB/PreparedSQLPlaceholdersUnitTest.inc | 8 ++++---- .../Tests/DB/PreparedSQLPlaceholdersUnitTest.php | 2 +- WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc | 8 ++++---- WordPress/Tests/WP/DeprecatedFunctionsUnitTest.php | 14 +++++++------- .../Tests/WP/DeprecatedParametersUnitTest.inc | 2 +- .../Tests/WP/DeprecatedParametersUnitTest.php | 8 ++------ 7 files changed, 20 insertions(+), 24 deletions(-) diff --git a/WordPress/Helpers/MinimumWPVersionTrait.php b/WordPress/Helpers/MinimumWPVersionTrait.php index 92df2a4a6e..15679337e0 100644 --- a/WordPress/Helpers/MinimumWPVersionTrait.php +++ b/WordPress/Helpers/MinimumWPVersionTrait.php @@ -79,7 +79,7 @@ trait MinimumWPVersionTrait { * * @var string WordPress version. */ - private $default_minimum_wp_version = '6.0'; + private $default_minimum_wp_version = '6.2'; /** * Overrule the minimum supported WordPress version with a command-line/config value. diff --git a/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.inc b/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.inc index bbceb7ce5b..19af3655a7 100644 --- a/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.inc +++ b/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.inc @@ -343,10 +343,10 @@ $where = $wpdb->prepare( ); // OK. // Disregard comments in the array_fill() $value param. -$wpdb->prepare( ' - xxx IN ( ' . implode( ',', array_fill( 0, count( $post_types ), '%i' /*comment*/ ) ) . ' )', - $fields -); // IdentifierWithinIN. +// Also test handling of %i when minimum supported WP version is not high enough yet. +// phpcs:set WordPress.DB.PreparedSQLPlaceholders minimum_wp_version 6.0 +$wpdb->prepare( 'xxx IN ( ' . implode( ',', array_fill( 0, count( $post_types ), '%i' /*comment*/ ) ) . ' )', $fields ); // IdentifierWithinIN. +// phpcs:set WordPress.DB.PreparedSQLPlaceholders minimum_wp_version $where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" diff --git a/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.php b/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.php index 10acc9493d..df0bc753bf 100644 --- a/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.php +++ b/WordPress/Tests/DB/PreparedSQLPlaceholdersUnitTest.php @@ -101,7 +101,7 @@ public function getErrorList() { 315 => 1, 322 => 1, - 347 => 2, // UnsupportedIdentifierPlaceholder + IdentifierWithinIN. + 348 => 2, // UnsupportedIdentifierPlaceholder + IdentifierWithinIN. 353 => 1, // Named parameter support. diff --git a/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc b/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc index 5c592b70d7..32a86faced 100644 --- a/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc +++ b/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.inc @@ -360,10 +360,6 @@ _excerpt_render_inner_columns_blocks(); readonly(); /* ============ WP 5.9.1 ============ */ wp_render_duotone_filter_preset(); - -/* - * Warning. - */ /* ============ WP 6.0 ============ */ image_attachment_fields_to_save(); wp_add_iframed_editor_assets_html(); @@ -384,6 +380,10 @@ install_global_terms(); sync_category_tag_slugs(); wp_get_attachment_thumb_file(); wp_typography_get_css_variable_inline_style(); + +/* + * Warning. + */ /* ============ WP 6.2 ============ */ _resolve_home_block_template(); get_page_by_title(); diff --git a/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.php b/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.php index 0aeaec42fa..b1bc8470e9 100644 --- a/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.php +++ b/WordPress/Tests/WP/DeprecatedFunctionsUnitTest.php @@ -28,7 +28,7 @@ final class DeprecatedFunctionsUnitTest extends AbstractSniffUnitTest { */ public function getErrorList() { $start_line = 8; - $end_line = 362; + $end_line = 382; $errors = array_fill( $start_line, ( ( $end_line - $start_line ) + 1 ), 1 ); // Unset the lines related to version comments. @@ -73,7 +73,11 @@ public function getErrorList() { $errors[353], $errors[357], $errors[359], - $errors[361] + $errors[361], + $errors[363], + $errors[369], + $errors[371], + $errors[373] ); return $errors; @@ -85,16 +89,12 @@ public function getErrorList() { * @return array Key is the line number, value is the number of expected warnings. */ public function getWarningList() { - $start_line = 368; + $start_line = 388; $end_line = 428; $warnings = array_fill( $start_line, ( ( $end_line - $start_line ) + 1 ), 1 ); // Unset the lines related to version comments. unset( - $warnings[373], - $warnings[375], - $warnings[377], - $warnings[387], $warnings[390], $warnings[414], $warnings[425] diff --git a/WordPress/Tests/WP/DeprecatedParametersUnitTest.inc b/WordPress/Tests/WP/DeprecatedParametersUnitTest.inc index 7c8c37ab33..0618b9bca0 100644 --- a/WordPress/Tests/WP/DeprecatedParametersUnitTest.inc +++ b/WordPress/Tests/WP/DeprecatedParametersUnitTest.inc @@ -94,6 +94,6 @@ wp_notify_postauthor( '', 'null' ); // Null as a string not null. wp_title_rss( 'deprecated' ); wp_upload_bits( '', 'deprecated' ); xfn_check( '', '', 'deprecated' ); +global_terms( $foo, 'deprecated' ); // All will give an WARNING as they have been deprecated after WP 5.8. -global_terms( $foo, 'deprecated' ); diff --git a/WordPress/Tests/WP/DeprecatedParametersUnitTest.php b/WordPress/Tests/WP/DeprecatedParametersUnitTest.php index 5f4a6432a8..5022b72469 100644 --- a/WordPress/Tests/WP/DeprecatedParametersUnitTest.php +++ b/WordPress/Tests/WP/DeprecatedParametersUnitTest.php @@ -28,7 +28,7 @@ final class DeprecatedParametersUnitTest extends AbstractSniffUnitTest { */ public function getErrorList() { $start_line = 42; - $end_line = 96; + $end_line = 97; $errors = array_fill( $start_line, ( ( $end_line - $start_line ) + 1 ), 1 ); $errors[22] = 1; @@ -51,10 +51,6 @@ public function getErrorList() { * @return array Key is the line number, value is the number of expected warnings. */ public function getWarningList() { - $start_line = 99; - $end_line = 99; - $errors = array_fill( $start_line, ( ( $end_line - $start_line ) + 1 ), 1 ); - - return $errors; + return array(); } }