Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions features/plugin-activate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,20 @@ Feature: Activate WordPress plugins
"""
And the return code should be 1

When I try `wp plugin activate akismet hello debug-bar`
When I try `wp plugin activate akismet debug-bar`
Then STDERR should be:
"""
Warning: The 'debug-bar' plugin could not be found.
Error: Only activated 2 of 3 plugins.
Error: Only activated 1 of 2 plugins.
"""
And STDOUT should be:
"""
Plugin 'akismet' activated.
Plugin 'hello' activated.
"""
And the return code should be 1

Scenario: Activate all when one plugin is hidden by "all_plugins" filter
Given I run `wp plugin install site-secrets`
Given I run `wp plugin install site-secrets https://github.com/wp-cli/sample-plugin/archive/refs/heads/master.zip`
And a wp-content/mu-plugins/hide-us-plugin.php file:
"""
<?php
Expand All @@ -55,7 +54,10 @@ Feature: Activate WordPress plugins
Then STDOUT should contain:
"""
Plugin 'akismet' activated.
Plugin 'hello' activated.
"""
And STDOUT should contain:
"""
Plugin 'sample-plugin' activated.
"""
And STDOUT should not contain:
"""
Expand Down Expand Up @@ -135,7 +137,7 @@ 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`
When I try `wp plugin activate --all --exclude=hello,hello-dolly`
Then STDOUT should be:
"""
Plugin 'akismet' activated.
Expand Down
22 changes: 11 additions & 11 deletions features/plugin-auto-updates-disable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Disable auto-updates for WordPress plugins

Background:
Given a WP install
And I run `wp plugin install duplicate-post --ignore-requirements`
And I run `wp plugin install duplicate-post https://github.com/wp-cli/sample-plugin/archive/refs/heads/master.zip --ignore-requirements`
And I run `wp plugin auto-updates enable --all`

@require-wp-5.5
Expand All @@ -16,7 +16,7 @@ Feature: Disable auto-updates for WordPress plugins

@require-wp-5.5
Scenario: Disable auto-updates for a single plugin
When I run `wp plugin auto-updates disable hello`
When I run `wp plugin auto-updates disable sample-plugin`
Then STDOUT should be:
"""
Success: Disabled 1 of 1 plugin auto-updates.
Expand All @@ -25,7 +25,7 @@ Feature: Disable auto-updates for WordPress plugins

@require-wp-5.5
Scenario: Disable auto-updates for multiple plugins
When I run `wp plugin auto-updates disable hello duplicate-post`
When I run `wp plugin auto-updates disable sample-plugin duplicate-post`
Then STDOUT should be:
"""
Success: Disabled 2 of 2 plugin auto-updates.
Expand All @@ -46,20 +46,20 @@ Feature: Disable auto-updates for WordPress plugins

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

@require-wp-5.5
Scenario: Filter when disabling auto-updates for already enabled plugins
When I run `wp plugin auto-updates disable hello`
When I run `wp plugin auto-updates disable sample-plugin`
And I run `wp plugin list --auto_update=on --format=count`
Then save STDOUT as {PLUGIN_COUNT}

Expand All @@ -72,8 +72,8 @@ Feature: Disable auto-updates for WordPress plugins

@require-wp-5.5
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`
When I run `wp plugin auto-updates disable sample-plugin`
And I run `wp plugin auto-updates disable sample-plugin duplicate-post --enabled-only`
Then STDOUT should be:
"""
Success: Disabled 1 of 1 plugin auto-updates.
Expand All @@ -82,8 +82,8 @@ Feature: Disable auto-updates for WordPress plugins

@require-wp-5.5
Scenario: Filtering everything away produces an error
When I run `wp plugin auto-updates disable hello`
And I try `wp plugin auto-updates disable hello --enabled-only`
When I run `wp plugin auto-updates disable sample-plugin`
And I try `wp plugin auto-updates disable sample-plugin --enabled-only`
Then STDERR should be:
"""
Error: No plugins provided to disable auto-updates for.
Expand Down
22 changes: 11 additions & 11 deletions features/plugin-auto-updates-enable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Enable auto-updates for WordPress plugins

Background:
Given a WP install
And I run `wp plugin install duplicate-post --ignore-requirements`
And I run `wp plugin install duplicate-post https://github.com/wp-cli/sample-plugin/archive/refs/heads/master.zip --ignore-requirements`

@require-wp-5.5
Scenario: Show an error if required params are missing
Expand All @@ -15,7 +15,7 @@ Feature: Enable auto-updates for WordPress plugins

@require-wp-5.5
Scenario: Enable auto-updates for a single plugin
When I run `wp plugin auto-updates enable hello`
When I run `wp plugin auto-updates enable sample-plugin`
Then STDOUT should be:
"""
Success: Enabled 1 of 1 plugin auto-updates.
Expand All @@ -24,7 +24,7 @@ Feature: Enable auto-updates for WordPress plugins

@require-wp-5.5
Scenario: Enable auto-updates for multiple plugins
When I run `wp plugin auto-updates enable hello duplicate-post`
When I run `wp plugin auto-updates enable sample-plugin duplicate-post`
Then STDOUT should be:
"""
Success: Enabled 2 of 2 plugin auto-updates.
Expand All @@ -45,20 +45,20 @@ Feature: Enable auto-updates for WordPress plugins

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

@require-wp-5.5
Scenario: Filter when enabling auto-updates for already enabled plugins
When I run `wp plugin auto-updates enable hello`
When I run `wp plugin auto-updates enable sample-plugin`
And I run `wp plugin list --status=inactive --auto_update=off --format=count`
Then save STDOUT as {PLUGIN_COUNT}

Expand All @@ -71,8 +71,8 @@ Feature: Enable auto-updates for WordPress plugins

@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`
And I run `wp plugin auto-updates enable hello duplicate-post --disabled-only`
When I run `wp plugin auto-updates enable sample-plugin`
And I run `wp plugin auto-updates enable sample-plugin duplicate-post --disabled-only`
Then STDOUT should be:
"""
Success: Enabled 1 of 1 plugin auto-updates.
Expand All @@ -81,8 +81,8 @@ Feature: Enable auto-updates for WordPress plugins

@require-wp-5.5
Scenario: Filtering everything away produces an error
When I run `wp plugin auto-updates enable hello`
And I try `wp plugin auto-updates enable hello --disabled-only`
When I run `wp plugin auto-updates enable sample-plugin`
And I try `wp plugin auto-updates enable sample-plugin --disabled-only`
Then STDERR should be:
"""
Error: No plugins provided to enable auto-updates for.
Expand Down
54 changes: 35 additions & 19 deletions features/plugin-auto-updates-status.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Show the status of auto-updates for WordPress plugins

Background:
Given a WP install
And I run `wp plugin install duplicate-post --ignore-requirements`
And I run `wp plugin install duplicate-post https://github.com/wp-cli/sample-plugin/archive/refs/heads/master.zip --ignore-requirements`

@require-wp-5.5
Scenario: Show an error if required params are missing
Expand All @@ -15,19 +15,19 @@ Feature: Show the status of auto-updates for WordPress plugins

@require-wp-5.5
Scenario: Show the status of auto-updates of a single plugin
When I run `wp plugin auto-updates status hello`
When I run `wp plugin auto-updates status sample-plugin`
Then STDOUT should be a table containing rows:
| name | status |
| hello | disabled |
| sample-plugin | disabled |
And the return code should be 0

@require-wp-5.5
Scenario: Show the status of auto-updates multiple plugins
When I run `wp plugin auto-updates status duplicate-post hello`
When I run `wp plugin auto-updates status duplicate-post sample-plugin`
Then STDOUT should be a table containing rows:
| name | status |
| duplicate-post | disabled |
| hello | disabled |
| sample-plugin | disabled |
And the return code should be 0

@require-wp-5.5
Expand All @@ -37,7 +37,7 @@ Feature: Show the status of auto-updates for WordPress plugins
| name | status |
| akismet | disabled |
| duplicate-post | disabled |
| hello | disabled |
| sample-plugin | disabled |
And the return code should be 0

When I run `wp plugin auto-updates enable --all`
Expand All @@ -46,25 +46,25 @@ Feature: Show the status of auto-updates for WordPress plugins
| name | status |
| akismet | enabled |
| duplicate-post | enabled |
| hello | enabled |
| sample-plugin | enabled |
And the return code should be 0

@require-wp-5.5
Scenario: The status can be filtered to only show enabled or disabled plugins
Given I run `wp plugin auto-updates enable hello`
Given I run `wp plugin auto-updates enable sample-plugin`

When I run `wp plugin auto-updates status --all`
Then STDOUT should be a table containing rows:
| name | status |
| akismet | disabled |
| duplicate-post | disabled |
| hello | enabled |
| sample-plugin | enabled |
And the return code should be 0

When I run `wp plugin auto-updates status --all --enabled-only`
Then STDOUT should be a table containing rows:
| name | status |
| hello | enabled |
| sample-plugin | enabled |
And the return code should be 0

When I run `wp plugin auto-updates status --all --disabled-only`
Expand All @@ -83,16 +83,19 @@ Feature: Show the status of auto-updates for WordPress plugins

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

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

When I run `wp plugin auto-updates status hello --field=status`
When I run `wp plugin auto-updates status sample-plugin --field=status`
Then STDOUT should be:
"""
enabled
Expand All @@ -101,23 +104,36 @@ Feature: Show the status of auto-updates for WordPress plugins
@require-wp-5.5
Scenario: Formatting options work
When I run `wp plugin auto-updates status --all --format=json`
Then STDOUT should be:
Then STDOUT should contain:
"""
{"name":"akismet","status":"disabled"}
"""
And STDOUT should contain:
"""
{"name":"sample-plugin","status":"disabled"}
"""
[{"name":"akismet","status":"disabled"},{"name":"hello","status":"disabled"},{"name":"duplicate-post","status":"disabled"}]
And STDOUT should contain:
"""
{"name":"duplicate-post","status":"disabled"}
"""

When I run `wp plugin auto-updates status --all --format=csv`
Then STDOUT should be:
Then STDOUT should contain:
"""
name,status
akismet,disabled
hello,disabled
"""
And STDOUT should contain:
"""
sample-plugin,disabled
"""
And STDOUT should contain:
"""
duplicate-post,disabled
"""

@require-wp-5.5
Scenario: Handle malformed option value
When I run `wp option update auto_update_plugins ""`
And I try `wp plugin auto-updates status hello`
And I try `wp plugin auto-updates status sample-plugin`
Then the return code should be 0
And STDERR should be empty
18 changes: 11 additions & 7 deletions features/plugin-deactivate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Feature: Deactivate WordPress plugins

Background:
Given a WP install
And I run `wp plugin activate akismet hello`
And I run `wp plugin install https://github.com/wp-cli/sample-plugin/archive/refs/heads/master.zip`
And I run `wp plugin activate akismet sample-plugin`

Scenario: Deactivate a plugin that's already activated
When I run `wp plugin deactivate akismet`
Expand All @@ -23,7 +24,7 @@ Feature: Deactivate WordPress plugins
And STDOUT should be empty
And the return code should be 1

When I try `wp plugin deactivate akismet hello debug-bar`
When I try `wp plugin deactivate akismet sample-plugin debug-bar`
Then STDERR should be:
"""
Warning: The 'debug-bar' plugin could not be found.
Expand All @@ -32,7 +33,7 @@ Feature: Deactivate WordPress plugins
And STDOUT should be:
"""
Plugin 'akismet' deactivated.
Plugin 'hello' deactivated.
Plugin 'sample-plugin' deactivated.
"""
And the return code should be 1

Expand Down Expand Up @@ -78,16 +79,19 @@ Feature: Deactivate WordPress plugins
"""

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

Scenario: Adding --exclude with plugin deactivate should throw an error unless --all given
When I try `wp plugin deactivate --exclude=hello`
When I try `wp plugin deactivate --exclude=sample-plugin`
Then the return code should be 1
And STDERR should be:
"""
Expand Down
Loading