From 6b3b8af785e740de2d9956dbc45ac73c4f7abb52 Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Thu, 5 Dec 2024 10:10:20 +0545 Subject: [PATCH] Preferred error type should be singular --- includes/CLI/Plugin_Check_Command.php | 4 ++-- tests/behat/features/plugin-check-severity.feature | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/includes/CLI/Plugin_Check_Command.php b/includes/CLI/Plugin_Check_Command.php index 0529611be..4c502d332 100644 --- a/includes/CLI/Plugin_Check_Command.php +++ b/includes/CLI/Plugin_Check_Command.php @@ -653,10 +653,10 @@ private function get_filtered_results_by_severity( $results, $error_severity, $w if ( 'ERROR' === $item['type'] && $item['severity'] >= $error_severity ) { $errors[] = $item; } elseif ( $include_low_severity_errors && 'ERROR' === $item['type'] && $item['severity'] < $error_severity ) { - $item['type'] = 'ERRORS_LOW_SEVERITY'; + $item['type'] = 'ERROR_LOW_SEVERITY'; $errors[] = $item; } elseif ( $include_low_severity_warnings && 'WARNING' === $item['type'] && $item['severity'] < $warning_severity ) { - $item['type'] = 'WARNINGS_LOW_SEVERITY'; + $item['type'] = 'WARNING_LOW_SEVERITY'; $warnings[] = $item; } elseif ( 'WARNING' === $item['type'] && $item['severity'] >= $warning_severity ) { $warnings[] = $item; diff --git a/tests/behat/features/plugin-check-severity.feature b/tests/behat/features/plugin-check-severity.feature index 3e82d13f9..7efe00a11 100644 --- a/tests/behat/features/plugin-check-severity.feature +++ b/tests/behat/features/plugin-check-severity.feature @@ -199,11 +199,11 @@ Feature: Test that the severity level in plugin check works. """ And STDOUT should contain: """ - WordPress.WP.AlternativeFunctions.rand_mt_rand,ERRORS_LOW_SEVERITY,5 + WordPress.WP.AlternativeFunctions.rand_mt_rand,ERROR_LOW_SEVERITY,5 """ And STDOUT should contain: """ - WordPress.Security.EscapeOutput.OutputNotEscaped,ERRORS_LOW_SEVERITY,5 + WordPress.Security.EscapeOutput.OutputNotEscaped,ERROR_LOW_SEVERITY,5 """ When I run the WP-CLI command `plugin check foo-bar-wp --format=csv --fields=code,type,severity --warning-severity=7 --include-low-severity-warnings` @@ -213,7 +213,7 @@ Feature: Test that the severity level in plugin check works. """ And STDOUT should contain: """ - upgrade_notice_limit,WARNINGS_LOW_SEVERITY,5 + upgrade_notice_limit,WARNING_LOW_SEVERITY,5 """ And STDOUT should contain: """