From 896ba14cd49fe718d7395e961a128e1bce4fc9bd Mon Sep 17 00:00:00 2001 From: Nilambar Sharma Date: Wed, 15 Jan 2025 16:06:26 +0545 Subject: [PATCH] Add feature tests for the exclude-codes argument --- tests/behat/features/plugin-check.feature | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/tests/behat/features/plugin-check.feature b/tests/behat/features/plugin-check.feature index 80c95135..8514ef78 100644 --- a/tests/behat/features/plugin-check.feature +++ b/tests/behat/features/plugin-check.feature @@ -119,6 +119,36 @@ Feature: Test that the WP-CLI command works. WordPress.Security.EscapeOutput.OutputNotEscaped """ + When I run the WP-CLI command `plugin check foo-single.php --exclude-codes=WordPress.WP.AlternativeFunctions.rand_mt_rand` + Then STDOUT should not contain: + """ + WordPress.WP.AlternativeFunctions.rand_mt_rand + """ + And STDOUT should contain: + """ + WordPress.Security.EscapeOutput.OutputNotEscaped + """ + + When I run the WP-CLI command `plugin check foo-single.php --exclude-codes=WordPress.Security.EscapeOutput.OutputNotEscaped` + Then STDOUT should not contain: + """ + WordPress.Security.EscapeOutput.OutputNotEscaped + """ + And STDOUT should contain: + """ + WordPress.WP.AlternativeFunctions.rand_mt_rand + """ + + When I run the WP-CLI command `plugin check foo-single.php --exclude-codes="WordPress.WP.AlternativeFunctions.rand_mt_rand,WordPress.Security.EscapeOutput.OutputNotEscaped"` + Then STDOUT should not contain: + """ + WordPress.Security.EscapeOutput.OutputNotEscaped + """ + And STDOUT should not contain: + """ + WordPress.WP.AlternativeFunctions.rand_mt_rand + """ + Scenario: Check plugin with special chars in plugin name Given a WP install with the Plugin Check plugin And a wp-content/plugins/johns-post-counter/johns-post-counter.php file: