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 0fb9c6f
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions tests/behat/features/plugin-check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,39 @@ 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=late_escaping`
Then STDOUT should contain:
"""
WordPress.Security.EscapeOutput.OutputNotEscaped
"""
And STDOUT should not contain:
"""
stable_tag_mismatch
"""

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:
"""
stable_tag_mismatch
"""

0 comments on commit 0fb9c6f

Please sign in to comment.