Skip to content

Commit 4f2f884

Browse files
Copilotswissspidy
andcommitted
Add test for network-activated plugins with missing files
Co-authored-by: swissspidy <[email protected]>
1 parent d1ccde9 commit 4f2f884

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

features/plugin-is-active.feature

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,33 @@ Feature: Check if a WordPress plugin is active
5454
When I try `wp plugin is-active akismet`
5555
Then STDERR should contain:
5656
"""
57-
Warning: Plugin 'akismet' is in the active_plugins option but the plugin file does not exist.
57+
Warning: Plugin 'akismet' is marked as active but the plugin file does not exist.
58+
"""
59+
And the return code should be 1
60+
61+
Scenario: Warn when network-activated plugin is in active_sitewide_plugins but file does not exist
62+
Given a WP multisite install
63+
64+
When I run `wp plugin activate akismet --network`
65+
Then STDOUT should contain:
66+
"""
67+
Success:
68+
"""
69+
70+
When I run `wp plugin is-active akismet --network`
71+
Then the return code should be 0
72+
73+
# Remove the plugin directory
74+
When I run `wp plugin path akismet --dir`
75+
Then save STDOUT as {PLUGIN_PATH}
76+
77+
When I run `rm -rf {PLUGIN_PATH}`
78+
Then the return code should be 0
79+
80+
# Now the plugin file is gone but still in active_sitewide_plugins
81+
When I try `wp plugin is-active akismet --network`
82+
Then STDERR should contain:
83+
"""
84+
Warning: Plugin 'akismet' is marked as active but the plugin file does not exist.
5885
"""
5986
And the return code should be 1

0 commit comments

Comments
 (0)