Skip to content

Commit

Permalink
Update check behat tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Dec 26, 2023
1 parent 72f3eb3 commit 33e1422
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/behat/features/plugin-check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,48 @@ Feature: Test that the WP-CLI command works.
"""
All output should be run through an escaping function
"""

When I run `wp plugin check hello.php --format=csv`
Then STDOUT should contain:
"""
line,column,type,code,message
49,31,ERROR,WordPress.WP.AlternativeFunctions.rand_mt_rand,"mt_rand() is discouraged. Use the far less predictable wp_rand() instead."
"""

When I run `wp plugin check hello.php --format=json`
Then STDOUT should contain:
"""
{"line":49,"column":31,"type":"ERROR","code":"WordPress.WP.AlternativeFunctions.rand_mt_rand","message":"mt_rand() is discouraged. Use the far less predictable wp_rand() instead."}
"""

When I run `wp plugin check hello.php --ignore-errors`
Then STDOUT should be empty

When I run `wp plugin check hello.php --checks=plugin_review_phpcs`
Then STDOUT should contain:
"""
WordPress.WP.AlternativeFunctions.rand_mt_rand
"""
And STDOUT should not contain:
"""
WordPress.Security.EscapeOutput.OutputNotEscaped
"""

When I run `wp plugin check hello.php --exclude-checks=late_escaping`
Then STDOUT should not contain:
"""
WordPress.Security.EscapeOutput.OutputNotEscaped
"""
And STDOUT should contain:
"""
WordPress.WP.AlternativeFunctions.rand_mt_rand
"""
When I run `wp plugin check hello.php --categories=security`
Then STDOUT should contain:
"""
WordPress.Security.EscapeOutput.OutputNotEscaped
"""
And STDOUT should not contain:
"""
WordPress.WP.AlternativeFunctions.rand_mt_rand
"""

0 comments on commit 33e1422

Please sign in to comment.