@@ -3,35 +3,52 @@ Feature: Plugin dependencies support
33 Background :
44 Given an empty cache
55
6+ @less-than-wp-6.5
7+ Scenario : Install plugin with dependencies using --with-dependencies flag
8+ Given a WP install
9+
10+ When I try `wp plugin install --with-dependencies bp-classic`
11+ Then STDERR should contain:
12+ """
13+ Installing plugins with dependencies requires WordPress 6.5 or greater.
14+ """
15+
616 @require-wp-6.5
717 Scenario : Install plugin with dependencies using --with-dependencies flag
818 Given a WP install
919
10- When I run `wp plugin install akismet `
20+ When I run `wp plugin install --with-dependencies bp-classic `
1121 Then STDOUT should contain:
1222 """
13- Plugin installed successfully.
23+ Installing BuddyPress
24+ """
25+ And STDOUT should contain:
26+ """
27+ Installing BP Classic
28+ """
29+ And STDOUT should contain:
30+ """
31+ Success: Installed 2 of 2 plugins.
1432 """
1533
16- # Create a test plugin with dependencies
17- And a wp-content/plugins/test-plugin/test-plugin.php file :
34+ When I run `wp plugin list --fields=name,status --format=csv`
35+ Then STDOUT should contain :
1836 """
19- <?php
20- /**
21- * Plugin Name: Test Plugin
22- * Requires Plugins: akismet
23- */
37+ buddypress,inactive
38+ """
39+ And STDOUT should contain:
40+ """
41+ bp-classic,inactive
2442 """
2543
26- When I run `wp plugin delete akismet --quiet`
27- Then STDOUT should be empty
44+ @less-than-wp-6.5
45+ Scenario : Install dependencies of an installed plugin
46+ Given a WP install
2847
29- # Note: Testing with actual WP.org plugins that have dependencies would be better
30- # but we'll test with a local plugin that declares dependencies
31- When I run `wp plugin get test-plugin --field=requires_plugins`
32- Then STDOUT should be:
48+ When I try `wp plugin install-dependencies akismet`
49+ Then STDERR should contain:
3350 """
34- akismet
51+ Installing plugin dependencies requires WordPress 6.5 or greater.
3552 """
3653
3754 @require-wp-6.5
@@ -44,7 +61,7 @@ Feature: Plugin dependencies support
4461 <?php
4562 /**
4663 * Plugin Name: Test Plugin
47- * Requires Plugins: akismet, hello
64+ * Requires Plugins: duplicate-post, debug-bar
4865 */
4966 """
5067
@@ -80,31 +97,76 @@ Feature: Plugin dependencies support
8097 <?php
8198 /**
8299 * Plugin Name: Test Plugin
83- * Requires Plugins: hello
100+ * Requires Plugins: akismet, buddypress
84101 */
85102 """
86103
87- When I run `wp plugin install-dependencies test-plugin --activate`
104+ When I try `wp plugin install-dependencies test-plugin --activate`
88105 Then STDOUT should contain:
89106 """
90- Installing 1 dependency for 'test-plugin'
107+ Installing 2 dependencies for 'test-plugin'
91108 """
92109 And STDOUT should contain:
93110 """
94- Success:
111+ Plugin 'buddypress' activated
112+ """
113+ And STDOUT should contain:
114+ """
115+ Success: Installed 1 of 2 plugins.
116+ """
117+ And STDERR should contain:
118+ """
119+ Warning: akismet: Plugin already installed.
95120 """
96121
97- When I run `wp plugin list --name=hello --field=status`
98- Then STDOUT should be:
122+ When I run `wp plugin list --fields=name,status --format=csv`
123+ Then STDOUT should contain:
124+ """
125+ buddypress,active
126+ """
127+ And STDOUT should contain:
128+ """
129+ akismet,active
130+ """
131+ # Only the dependencies are activated, not the plugin itself.
132+ And STDOUT should contain:
133+ """
134+ test-plugin,inactive
135+ """
136+
137+ @require-wp-6.5
138+ Scenario : Force install dependencies
139+ Given a WP install
140+
141+ # Create a test plugin with dependencies
142+ And a wp-content/plugins/test-plugin/test-plugin.php file:
143+ """
144+ <?php
145+ /**
146+ * Plugin Name: Test Plugin
147+ * Requires Plugins: akismet
148+ */
149+ """
150+
151+ When I run `wp plugin install-dependencies test-plugin --force`
152+ Then STDOUT should contain:
153+ """
154+ Installing 1 dependency for 'test-plugin'
155+ """
156+ And STDOUT should contain:
157+ """
158+ Installing Akismet
159+ """
160+ And STDOUT should contain:
99161 """
100- active
162+ Success: Installed 1 of 1 plugins.
101163 """
164+ And STDERR should be empty
102165
103166 @require-wp-6.5
104167 Scenario : Install plugin with no dependencies
105168 Given a WP install
106169
107- # Create a test plugin without dependencies
108170 And a wp-content/plugins/test-plugin/test-plugin.php file:
109171 """
110172 <?php
@@ -126,6 +188,6 @@ Feature: Plugin dependencies support
126188 When I try `wp plugin install-dependencies non-existent-plugin`
127189 Then STDERR should contain:
128190 """
129- Error:
191+ Error: The 'non-existent-plugin' plugin could not be found.
130192 """
131193 And the return code should be 1
0 commit comments