Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further improve SQLite testing #379

Merged
merged 13 commits into from Nov 10, 2023
8 changes: 5 additions & 3 deletions features/plugin-activate.feature
Expand Up @@ -51,7 +51,9 @@ Feature: Activate WordPress plugins
} );
"""

When 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
When I try `wp plugin activate --all`
Then STDOUT should contain:
"""
Plugin 'akismet' activated.
Expand Down Expand Up @@ -132,10 +134,9 @@ Feature: Activate WordPress plugins

Scenario: Adding --exclude with plugin activate --all should exclude the plugins specified via --exclude
When I try `wp plugin activate --all --exclude=hello`
Then STDOUT should be:
Then STDOUT should contain:
"""
Plugin 'akismet' activated.
Success: Activated 1 of 1 plugins.
"""
And the return code should be 0

Expand All @@ -148,3 +149,4 @@ Feature: Activate WordPress plugins
Success:
"""
And the return code should be 0

49 changes: 12 additions & 37 deletions features/plugin-auto-updates-disable.feature
Expand Up @@ -32,25 +32,19 @@ Feature: Disable auto-updates for WordPress plugins
"""
And the return code should be 0

@require-wp-5.5 @require-mysql
@require-wp-5.5
Scenario: Disable auto-updates for all plugins
When I run `wp plugin auto-updates disable --all`
Then STDOUT should be:
"""
Success: Disabled 3 of 3 plugin auto-updates.
"""
And the return code should be 0
When I run `wp plugin list --status=inactive --format=count`
Then save STDOUT as {PLUGIN_COUNT}

@require-wp-5.5 @require-sqlite
Scenario: Disable auto-updates for all plugins
When I run `wp plugin auto-updates disable --all`
Then STDOUT should be:
"""
Success: Disabled 4 of 4 plugin auto-updates.
Success: Disabled {PLUGIN_COUNT} of {PLUGIN_COUNT} plugin auto-updates.
"""
And the return code should be 0

@require-wp-5.5 @require-mysql
@require-wp-5.5
Scenario: Disable auto-updates for already disabled plugins
When I run `wp plugin auto-updates disable hello`
And I try `wp plugin auto-updates disable --all`
Expand All @@ -63,41 +57,22 @@ Feature: Disable auto-updates for WordPress plugins
Error: Only disabled 2 of 3 plugin auto-updates.
"""

@require-wp-5.5 @require-sqlite
Scenario: Disable auto-updates for already disabled plugins
@require-wp-5.5
Scenario: Filter when disabling auto-updates for already enabled plugins
When I run `wp plugin auto-updates disable hello`
And I try `wp plugin auto-updates disable --all`
Then STDERR should contain:
"""
Warning: Auto-updates already disabled for plugin hello.
"""
And STDERR should contain:
"""
Error: Only disabled 3 of 4 plugin auto-updates.
"""

@require-wp-5.5 @require-mysql
Scenario: Filter when enabling auto-updates for already disabled plugins
When I run `wp plugin auto-updates disable hello`
And I run `wp plugin auto-updates disable --all --enabled-only`
Then STDOUT should be:
"""
Success: Disabled 2 of 2 plugin auto-updates.
"""
And the return code should be 0
When I run `wp plugin list --auto_update=on --format=count`
Then save STDOUT as {PLUGIN_COUNT}

@require-wp-5.5 @require-sqlite
Scenario: Filter when enabling auto-updates for already disabled plugins
When I run `wp plugin auto-updates disable hello`
And I run `wp plugin auto-updates disable --all --enabled-only`
When I run `wp plugin auto-updates disable --all --enabled-only`
Then STDOUT should be:
"""
Success: Disabled 3 of 3 plugin auto-updates.
Success: Disabled {PLUGIN_COUNT} of {PLUGIN_COUNT} plugin auto-updates.
"""
And the return code should be 0

@require-wp-5.5
Scenario: Filter when enabling auto-updates for already disabled selection of plugins
Scenario: Filter when disabling auto-updates for already disabled selection of plugins
When I run `wp plugin auto-updates disable hello`
And I run `wp plugin auto-updates disable hello duplicate-post --enabled-only`
Then STDOUT should be:
Expand Down
46 changes: 10 additions & 36 deletions features/plugin-auto-updates-enable.feature
Expand Up @@ -31,25 +31,19 @@ Feature: Enable auto-updates for WordPress plugins
"""
And the return code should be 0

@require-wp-5.5 @require-mysql
@require-wp-5.5
Scenario: Enable auto-updates for all plugins
When I run `wp plugin auto-updates enable --all`
Then STDOUT should be:
"""
Success: Enabled 3 of 3 plugin auto-updates.
"""
And the return code should be 0
When I run `wp plugin list --status=inactive --format=count`
Then save STDOUT as {PLUGIN_COUNT}

@require-wp-5.5 @require-sqlite
Scenario: Enable auto-updates for all plugins
When I run `wp plugin auto-updates enable --all`
Then STDOUT should be:
"""
Success: Enabled 4 of 4 plugin auto-updates.
Success: Enabled {PLUGIN_COUNT} of {PLUGIN_COUNT} plugin auto-updates.
"""
And the return code should be 0

@require-wp-5.5 @require-mysql
@require-wp-5.5
Scenario: Enable auto-updates for already enabled plugins
When I run `wp plugin auto-updates enable hello`
And I try `wp plugin auto-updates enable --all`
Expand All @@ -62,36 +56,16 @@ Feature: Enable auto-updates for WordPress plugins
Error: Only enabled 2 of 3 plugin auto-updates.
"""

@require-wp-5.5 @require-sqlite
Scenario: Enable auto-updates for already enabled plugins
When I run `wp plugin auto-updates enable hello`
And I try `wp plugin auto-updates enable --all`
Then STDERR should contain:
"""
Warning: Auto-updates already enabled for plugin hello.
"""
And STDERR should contain:
"""
Error: Only enabled 3 of 4 plugin auto-updates.
"""

@require-wp-5.5 @require-mysql
@require-wp-5.5
Scenario: Filter when enabling auto-updates for already enabled plugins
When I run `wp plugin auto-updates enable hello`
And I run `wp plugin auto-updates enable --all --disabled-only`
Then STDOUT should be:
"""
Success: Enabled 2 of 2 plugin auto-updates.
"""
And the return code should be 0
And I run `wp plugin list --status=inactive --auto_update=off --format=count`
Then save STDOUT as {PLUGIN_COUNT}

@require-wp-5.5 @require-sqlite
Scenario: Filter when enabling auto-updates for already enabled plugins
When I run `wp plugin auto-updates enable hello`
And I run `wp plugin auto-updates enable --all --disabled-only`
When I run `wp plugin auto-updates enable --all --disabled-only`
Then STDOUT should be:
"""
Success: Enabled 3 of 3 plugin auto-updates.
Success: Enabled {PLUGIN_COUNT} of {PLUGIN_COUNT} plugin auto-updates.
"""
And the return code should be 0

Expand Down
40 changes: 2 additions & 38 deletions features/plugin-auto-updates-status.feature
Expand Up @@ -81,32 +81,14 @@ Feature: Show the status of auto-updates for WordPress plugins
Error: --enabled-only and --disabled-only are mutually exclusive and cannot be used at the same time.
"""

@require-wp-5.5 @require-mysql
Scenario: The fields can be shown individually
Given I run `wp plugin auto-updates enable hello`

When I run `wp plugin auto-updates status --all --disabled-only --field=name`
Then STDOUT should be:
"""
akismet
duplicate-post
"""

When I run `wp plugin auto-updates status hello --field=status`
Then STDOUT should be:
"""
enabled
"""

@require-wp-5.5 @require-sqlite
@require-wp-5.5
Scenario: The fields can be shown individually
Given I run `wp plugin auto-updates enable hello`

When I run `wp plugin auto-updates status --all --disabled-only --field=name`
Then STDOUT should be:
"""
akismet
sqlite-database-integration
duplicate-post
"""

Expand All @@ -116,7 +98,7 @@ Feature: Show the status of auto-updates for WordPress plugins
enabled
"""

@require-wp-5.5 @require-mysql
@require-wp-5.5
Scenario: Formatting options work
When I run `wp plugin auto-updates status --all --format=json`
Then STDOUT should be:
Expand All @@ -132,21 +114,3 @@ Feature: Show the status of auto-updates for WordPress plugins
hello,disabled
duplicate-post,disabled
"""

@require-wp-5.5 @require-sqlite
Scenario: Formatting options work
When I run `wp plugin auto-updates status --all --format=json`
Then STDOUT should be:
"""
[{"name":"akismet","status":"disabled"},{"name":"hello","status":"disabled"},{"name":"sqlite-database-integration","status":"disabled"},{"name":"duplicate-post","status":"disabled"}]
"""

When I run `wp plugin auto-updates status --all --format=csv`
Then STDOUT should be:
"""
name,status
akismet,disabled
hello,disabled
sqlite-database-integration,disabled
duplicate-post,disabled
"""
29 changes: 0 additions & 29 deletions features/plugin-delete.feature
Expand Up @@ -12,7 +12,6 @@ Feature: Delete WordPress plugins
"""
And the return code should be 0

@require-mysql
Scenario: Delete all installed plugins
When I run `wp plugin delete --all`
Then STDOUT should be:
Expand All @@ -29,24 +28,6 @@ Feature: Delete WordPress plugins
Success: No plugins deleted.
"""

@require-sqlite
Scenario: Delete all installed plugins
When I run `wp plugin delete --all`
Then STDOUT should be:
"""
Deleted 'akismet' plugin.
Deleted 'hello' plugin.
Deleted 'sqlite-database-integration' plugin.
Success: Deleted 3 of 3 plugins.
"""
And the return code should be 0

When I run the previous command again
Then STDOUT should be:
"""
Success: No plugins deleted.
"""

Scenario: Attempting to delete a plugin that doesn't exist
When I try `wp plugin delete edit-flow`
Then STDOUT should be:
Expand All @@ -59,7 +40,6 @@ Feature: Delete WordPress plugins
"""
And the return code should be 0

@require-mysql
Scenario: Excluding a plugin from deletion when using --all switch
When I try `wp plugin delete --all --exclude=akismet,hello`
Then STDOUT should be:
Expand All @@ -68,15 +48,6 @@ Feature: Delete WordPress plugins
"""
And the return code should be 0

@require-sqlite
Scenario: Excluding a plugin from deletion when using --all switch
When I try `wp plugin delete --all --exclude=akismet,hello,sqlite-database-integration`
Then STDOUT should be:
"""
Success: No plugins deleted.
"""
And the return code should be 0

Scenario: Excluding a missing plugin should not throw an error
Given a WP install
And I run `wp plugin delete --all --exclude=missing-plugin`
Expand Down
10 changes: 0 additions & 10 deletions features/plugin-uninstall.feature
Expand Up @@ -72,7 +72,6 @@ Feature: Uninstall a WordPress plugin
Success: Uninstalled 2 of 2 plugins.
"""

@require-mysql
Scenario: Excluding a plugin from uninstallation when using --all switch
When I try `wp plugin uninstall --all --exclude=akismet,hello`
Then STDOUT should be:
Expand All @@ -81,15 +80,6 @@ Feature: Uninstall a WordPress plugin
"""
And the return code should be 0

@require-sqlite
Scenario: Excluding a plugin from uninstallation when using --all switch
When I try `wp plugin uninstall --all --exclude=akismet,hello,sqlite-database-integration`
Then STDOUT should be:
"""
Success: No plugins uninstalled.
"""
And the return code should be 0

Scenario: Excluding a missing plugin should not throw an error
Given a WP install
And I run `wp plugin uninstall --all --exclude=missing-plugin`
Expand Down
12 changes: 6 additions & 6 deletions features/plugin-update.feature
Expand Up @@ -13,8 +13,8 @@ Feature: Update WordPress plugins

When I run `wp plugin list`
Then STDOUT should be a table containing rows:
| name | status | update | version |
| wordpress-importer | inactive | available | 0.5 |
| name | status | update | version | auto_update |
| wordpress-importer | inactive | available | 0.5 | off |

When I try `wp plugin update akismet --version=0.5.3`
Then STDERR should be:
Expand All @@ -25,16 +25,16 @@ Feature: Update WordPress plugins

When I run `wp plugin list`
Then STDOUT should be a table containing rows:
| name | status | update | version |
| wordpress-importer | inactive | available | 0.5 |
| name | status | update | version | auto_update |
| wordpress-importer | inactive | available | 0.5 | off |

When I run `wp plugin update wordpress-importer`
Then STDOUT should not be empty

When I run `wp plugin list`
Then STDOUT should be a table containing rows:
| name | status | update | version |
| wordpress-importer | inactive | none | {UPDATE_VERSION} |
| name | status | update | version | auto_update |
| wordpress-importer | inactive | none | {UPDATE_VERSION} | off |

Scenario: Error when both --minor and --patch are provided
Given a WP install
Expand Down