Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Sep 7, 2024
1 parent f59ee3e commit 06009d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion includes/Traits/Amend_Check_Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' => ( 1 === count( $filename ) ) ? reset( $filename ) : $filename[1],
'line' => $line,
'column' => $column,
'link' => $this->get_file_editor_url( $result, $file, $line ),
Expand Down
4 changes: 4 additions & 0 deletions tests/behat/features/plugin-check-severity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down

0 comments on commit 06009d0

Please sign in to comment.