mirror of
https://gh.wpcy.net/https://github.com/wp-cli/extension-command.git
synced 2026-06-11 01:53:58 +08:00
86 lines
2.4 KiB
Gherkin
86 lines
2.4 KiB
Gherkin
Feature: Check if a WordPress plugin is active
|
|
|
|
Background:
|
|
Given a WP install
|
|
|
|
Scenario: Check if an active plugin is active
|
|
When I run `wp plugin activate akismet`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Success:
|
|
"""
|
|
|
|
When I run `wp plugin is-active akismet`
|
|
Then the return code should be 0
|
|
|
|
Scenario: Check if an inactive plugin is not active
|
|
When I run `wp plugin activate akismet`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Success:
|
|
"""
|
|
|
|
When I run `wp plugin deactivate akismet`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Success:
|
|
"""
|
|
|
|
When I try `wp plugin is-active akismet`
|
|
Then the return code should be 1
|
|
|
|
Scenario: Check if a non-existent plugin is not active
|
|
When I try `wp plugin is-active non-existent-plugin`
|
|
Then the return code should be 1
|
|
|
|
Scenario: Warn when plugin is in active_plugins but file does not exist
|
|
When I run `wp plugin activate akismet`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Success:
|
|
"""
|
|
|
|
When I run `wp plugin is-active akismet`
|
|
Then the return code should be 0
|
|
|
|
# Remove the plugin directory
|
|
When I run `wp plugin path akismet --dir`
|
|
Then save STDOUT as {PLUGIN_PATH}
|
|
|
|
When I run `rm -rf {PLUGIN_PATH}`
|
|
Then the return code should be 0
|
|
|
|
# Now the plugin file is gone but still in active_plugins
|
|
When I try `wp plugin is-active akismet`
|
|
Then STDERR should contain:
|
|
"""
|
|
Warning: Plugin 'akismet' is marked as active but the plugin file does not exist.
|
|
"""
|
|
And the return code should be 1
|
|
|
|
Scenario: Warn when network-activated plugin is in active_sitewide_plugins but file does not exist
|
|
Given a WP multisite install
|
|
|
|
When I run `wp plugin activate akismet --network`
|
|
Then STDOUT should contain:
|
|
"""
|
|
Success:
|
|
"""
|
|
|
|
When I run `wp plugin is-active akismet --network`
|
|
Then the return code should be 0
|
|
|
|
# Remove the plugin directory
|
|
When I run `wp plugin path akismet --dir`
|
|
Then save STDOUT as {PLUGIN_PATH}
|
|
|
|
When I run `rm -rf {PLUGIN_PATH}`
|
|
Then the return code should be 0
|
|
|
|
# Now the plugin file is gone but still in active_sitewide_plugins
|
|
When I try `wp plugin is-active akismet --network`
|
|
Then STDERR should contain:
|
|
"""
|
|
Warning: Plugin 'akismet' is marked as active but the plugin file does not exist.
|
|
"""
|
|
And the return code should be 1
|