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

Update some tests for SQLite #378

Merged
merged 2 commits into from Nov 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
38 changes: 35 additions & 3 deletions features/plugin-auto-updates-disable.feature
Expand Up @@ -32,7 +32,7 @@ Feature: Disable auto-updates for WordPress plugins
"""
And the return code should be 0

@require-wp-5.5
@require-wp-5.5 @require-mysql
Scenario: Disable auto-updates for all plugins
When I run `wp plugin auto-updates disable --all`
Then STDOUT should be:
Expand All @@ -41,7 +41,16 @@ Feature: Disable auto-updates for WordPress plugins
"""
And the return code should be 0

@require-wp-5.5
@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.
"""
And the return code should be 0

@require-wp-5.5 @require-mysql
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 @@ -54,7 +63,20 @@ Feature: Disable auto-updates for WordPress plugins
Error: Only disabled 2 of 3 plugin auto-updates.
"""

@require-wp-5.5
@require-wp-5.5 @require-sqlite
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`
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`
Expand All @@ -64,6 +86,16 @@ Feature: Disable auto-updates for WordPress plugins
"""
And the return code should be 0

@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`
Then STDOUT should be:
"""
Success: Disabled 3 of 3 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
When I run `wp plugin auto-updates disable hello`
Expand Down
38 changes: 35 additions & 3 deletions features/plugin-auto-updates-enable.feature
Expand Up @@ -31,7 +31,7 @@ Feature: Enable auto-updates for WordPress plugins
"""
And the return code should be 0

@require-wp-5.5
@require-wp-5.5 @require-mysql
Scenario: Enable auto-updates for all plugins
When I run `wp plugin auto-updates enable --all`
Then STDOUT should be:
Expand All @@ -40,7 +40,16 @@ Feature: Enable auto-updates for WordPress plugins
"""
And the return code should be 0

@require-wp-5.5
@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.
"""
And the return code should be 0

@require-wp-5.5 @require-mysql
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 @@ -53,7 +62,20 @@ Feature: Enable auto-updates for WordPress plugins
Error: Only enabled 2 of 3 plugin auto-updates.
"""

@require-wp-5.5
@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
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`
Expand All @@ -63,6 +85,16 @@ Feature: Enable auto-updates for WordPress plugins
"""
And the return code should be 0

@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`
Then STDOUT should be:
"""
Success: Enabled 3 of 3 plugin auto-updates.
"""
And the return code should be 0

@require-wp-5.5
Scenario: Filter when enabling auto-updates for already enabled selection of plugins
When I run `wp plugin auto-updates enable hello`
Expand Down
41 changes: 38 additions & 3 deletions features/plugin-auto-updates-status.feature
Expand Up @@ -81,7 +81,7 @@ 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-wp-5.5 @require-mysql
Scenario: The fields can be shown individually
Given I run `wp plugin auto-updates enable hello`

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

@require-wp-5.5
Scenario: Formatting options work
@require-wp-5.5 @require-sqlite
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
"""

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

@require-wp-5.5 @require-mysql
Scenario: Formatting options work
When I run `wp plugin auto-updates status --all --format=json`
Then STDOUT should be:
"""
Expand All @@ -115,3 +132,21 @@ 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: 29 additions & 0 deletions features/plugin-delete.feature
Expand Up @@ -12,6 +12,7 @@ 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 @@ -28,6 +29,24 @@ 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 @@ -40,6 +59,7 @@ 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 @@ -48,6 +68,15 @@ 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: 9 additions & 1 deletion features/plugin-uninstall.feature
Expand Up @@ -72,6 +72,7 @@ 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 @@ -80,7 +81,14 @@ 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
Expand Down