Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Nov 3, 2023
1 parent 929a923 commit ac7a242
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 6 deletions.
6 changes: 5 additions & 1 deletion features/check-core-update.feature
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ Feature: Check whether WordPress is up to date
| name | status | message |
| core-update | success | WordPress is at the latest version. |

# This test downgrades to WordPress 5.9.0, but the SQLite plugin requires 6.0+
@requires-mysql
Scenario: WordPress has a new minor version but no new major version
Given a WP install
And I run `wp core download --version=4.5.1 --force`
And I run `wp core download --version=5.9.0 --force`
And I run `wp theme activate twentyfifteen`

When I try `wp doctor check core-update`
Expand All @@ -31,6 +33,8 @@ Feature: Check whether WordPress is up to date
"""
And the return code should be 1

# This test downgrades to WordPress 5.9.0, but the SQLite plugin requires 6.0+
@requires-mysql
Scenario: WordPress has a new major version but no new minor version
Given a WP install
And I run `wp core download --version=4.4.9 --force`
Expand Down
2 changes: 1 addition & 1 deletion features/check-file-contents.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Feature: Check files in a WordPress install
Given a wp-content/mu-plugins/exploited.php file:
"""
<?php
eval( base64_decode( $_POST ) );
eval( base64_decode( $_POST[''] ?? '' ) );
"""

When I try `wp doctor check file-eval`
Expand Down
12 changes: 9 additions & 3 deletions features/check-plugin-active-count.feature
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ Feature: Check whether a high number of plugins are activated

Scenario: Less than threshold plugins are active
Given a WP install
And I run `wp plugin activate --all`
# Uses "try" because the SQLite plugin attempts to do a redirect.
# See https://github.com/WordPress/sqlite-database-integration/issues/49
And I try `wp plugin activate --all`

When I run `wp doctor check plugin-active-count`
Then STDOUT should be a table containing rows:
Expand All @@ -27,7 +29,9 @@ Feature: Check whether a high number of plugins are activated
threshold_count: 3
"""
And I run `wp plugin install user-switching rewrite-rules-inspector`
And I run `wp plugin activate --all`
# Uses "try" because the SQLite plugin attempts to do a redirect.
# See https://github.com/WordPress/sqlite-database-integration/issues/49
And I try `wp plugin activate --all`

When I run `wp doctor check plugin-active-count --config=config.yml`
Then STDOUT should be a table containing rows:
Expand All @@ -36,7 +40,9 @@ Feature: Check whether a high number of plugins are activated

Scenario: Include network-enabled plugins in active plugin count
Given a WP multisite installation
And I run `wp plugin activate --network --all`
# Uses "try" because the SQLite plugin attempts to do a redirect.
# See https://github.com/WordPress/sqlite-database-integration/issues/49
And I try `wp plugin activate --network --all`

When I run `wp doctor check plugin-active-count`
Then STDOUT should be a table containing rows:
Expand Down
2 changes: 2 additions & 0 deletions features/check-plugin-deactivated.feature
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Feature: Check whether a high percentage of plugins are deactivated
| name | status | message |
| plugin-deactivated | warning | Greater than 60 percent of plugins are deactivated. |

# This test deletes all plugins, but SQLite requires an integration plugin to be installed.
@require-mysql
Scenario: Gracefully handle no plugins installed
Given a WP install
And I run `wp plugin uninstall --all`
Expand Down
4 changes: 3 additions & 1 deletion features/check.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ Feature: Basic check usage

Scenario: Use --spotlight to focus on warnings and errors
Given a WP install
And I run `wp plugin activate --all`
# Uses "try" because the SQLite plugin attempts to do a redirect.
# See https://github.com/WordPress/sqlite-database-integration/issues/49
And I try `wp plugin activate --all`
And I run `wp plugin update --all`
And I run `wp theme update --all`

Expand Down

0 comments on commit ac7a242

Please sign in to comment.