Skip to content

Commit

Permalink
phptests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
davidperezgar committed Oct 10, 2024
1 parent 398ab67 commit 9fed972
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 29 deletions.
3 changes: 2 additions & 1 deletion includes/CLI/Plugin_Check_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,7 @@ private function has_runtime_check( array $checks ) {
* @param array $results Check results.
* @param int $error_severity Error severity level.
* @param int $warning_severity Warning severity level.
* @param bool $show_error_severity Show error severity as warning.
* @return array Filtered results.
*/
private function get_filtered_results_by_severity( $results, $error_severity, $warning_severity, $show_error_severity = false ) {
Expand All @@ -692,7 +693,7 @@ function ( $item ) use ( $error_severity ) {
return ( 'ERROR' === $item['type'] && $item['severity'] < $error_severity );

Check warning on line 693 in includes/CLI/Plugin_Check_Command.php

View check run for this annotation

Codecov / codecov/patch

includes/CLI/Plugin_Check_Command.php#L690-L693

Added lines #L690 - L693 were not covered by tests
}
);

$errors_warning = array_map(
function ( $item ) {
$item['type'] = 'WARNING';
Expand Down
33 changes: 5 additions & 28 deletions tests/behat/features/plugin-check-severity.feature
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ Feature: Test that the severity level in plugin check works.
"""
obfuscated_code_detected,ERROR,6
"""
And STDOUT should contain:
And STDOUT should not contain:
"""
WordPress.WP.AlternativeFunctions.rand_mt_rand,WARNING,5
WordPress.WP.AlternativeFunctions.rand_mt_rand,ERROR,5
"""
And STDOUT should contain:
"""
Expand All @@ -149,9 +149,9 @@ Feature: Test that the severity level in plugin check works.
"""
obfuscated_code_detected,ERROR,6
"""
And STDOUT should contain:
And STDOUT should not contain:
"""
WordPress.WP.AlternativeFunctions.rand_mt_rand,WARNING,5
WordPress.WP.AlternativeFunctions.rand_mt_rand,ERROR,5
"""
And STDOUT should contain:
"""
Expand Down Expand Up @@ -193,27 +193,4 @@ 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 --severity=10`
Then STDOUT should contain:
"""
allow_unfiltered_uploads_detected,WARNING,7
"""
And STDOUT should contain:
"""
obfuscated_code_detected,WARNING,6
"""
And STDOUT should contain:
"""
WordPress.WP.AlternativeFunctions.rand_mt_rand,WARNING,5
"""
And STDOUT should contain:
"""
outdated_tested_upto_header,WARNING,7
"""
And STDOUT should not contain:
"""
default_readme_text,WARNING,7
"""
And STDOUT should not contain:
"""
upgrade_notice_limit,WARNING,5
"""
Then STDOUT should be empty

0 comments on commit 9fed972

Please sign in to comment.