From d985c0243177fd12fc211381116a3f67c92d07fa Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Sat, 7 Sep 2024 21:04:12 +0545 Subject: [PATCH] Update tests --- includes/Traits/Amend_Check_Result.php | 3 ++- tests/behat/features/plugin-check-severity.feature | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/includes/Traits/Amend_Check_Result.php b/includes/Traits/Amend_Check_Result.php index 4dc5a1951..4a3737db3 100644 --- a/includes/Traits/Amend_Check_Result.php +++ b/includes/Traits/Amend_Check_Result.php @@ -34,13 +34,14 @@ trait Amend_Check_Result { * @param int $severity Severity level. Default is 5. */ protected function add_result_message_for_file( Check_Result $result, $error, $message, $code, $file, $line = 0, $column = 0, string $docs = '', $severity = 5 ) { + $filename = explode( $result->plugin()->path(), $file ); $result->add_message( (bool) $error, $message, array( 'code' => $code, - 'file' => str_replace( $result->plugin()->path(), '', $file ), + 'file' => $filename[1], 'line' => $line, 'column' => $column, 'link' => $this->get_file_editor_url( $result, $file, $line ), diff --git a/tests/behat/features/plugin-check-severity.feature b/tests/behat/features/plugin-check-severity.feature index 38323ae62..bf86f9f28 100644 --- a/tests/behat/features/plugin-check-severity.feature +++ b/tests/behat/features/plugin-check-severity.feature @@ -64,6 +64,10 @@ Feature: Test that the severity level in plugin check works. When I run the WP-CLI command `plugin check foo-bar-wp --format=csv --fields=code,type,severity` Then STDOUT should contain: + """ + FILE: foo-bar-wp.php + """ + And STDOUT should contain: """ allow_unfiltered_uploads_detected,ERROR,7 """