-
Notifications
You must be signed in to change notification settings - Fork 84
Expand file tree
/
Copy pathplugin-is-active.feature
More file actions
86 lines (68 loc) · 2.38 KB
/
plugin-is-active.feature
File metadata and controls
86 lines (68 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
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