|
| 1 | +Feature: Plugin dependencies support |
| 2 | + |
| 3 | + Background: |
| 4 | + Given an empty cache |
| 5 | + |
| 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 | + |
| 16 | + @require-wp-6.5 |
| 17 | + Scenario: Install plugin with dependencies using --with-dependencies flag |
| 18 | + Given a WP install |
| 19 | + |
| 20 | + When I run `wp plugin install --with-dependencies bp-classic` |
| 21 | + Then STDOUT should contain: |
| 22 | + """ |
| 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. |
| 32 | + """ |
| 33 | + |
| 34 | + When I run `wp plugin list --fields=name,status --format=csv` |
| 35 | + Then STDOUT should contain: |
| 36 | + """ |
| 37 | + buddypress,inactive |
| 38 | + """ |
| 39 | + And STDOUT should contain: |
| 40 | + """ |
| 41 | + bp-classic,inactive |
| 42 | + """ |
| 43 | + |
| 44 | + @less-than-wp-6.5 |
| 45 | + Scenario: Install dependencies of an installed plugin |
| 46 | + Given a WP install |
| 47 | + |
| 48 | + When I try `wp plugin install-dependencies akismet` |
| 49 | + Then STDERR should contain: |
| 50 | + """ |
| 51 | + Installing plugin dependencies requires WordPress 6.5 or greater. |
| 52 | + """ |
| 53 | + |
| 54 | + @require-wp-6.5 |
| 55 | + Scenario: Install dependencies of an installed plugin |
| 56 | + Given a WP install |
| 57 | + |
| 58 | + # Create a test plugin with dependencies |
| 59 | + And a wp-content/plugins/test-plugin/test-plugin.php file: |
| 60 | + """ |
| 61 | + <?php |
| 62 | + /** |
| 63 | + * Plugin Name: Test Plugin |
| 64 | + * Requires Plugins: duplicate-post, debug-bar |
| 65 | + */ |
| 66 | + """ |
| 67 | + |
| 68 | + When I run `wp plugin install-dependencies test-plugin` |
| 69 | + Then STDOUT should contain: |
| 70 | + """ |
| 71 | + Installing 2 dependencies for 'test-plugin' |
| 72 | + """ |
| 73 | + And STDOUT should contain: |
| 74 | + """ |
| 75 | + Success: |
| 76 | + """ |
| 77 | + |
| 78 | + When I run `wp plugin list --name=duplicate-post --field=status` |
| 79 | + Then STDOUT should be: |
| 80 | + """ |
| 81 | + inactive |
| 82 | + """ |
| 83 | + |
| 84 | + When I run `wp plugin list --name=debug-bar --field=status` |
| 85 | + Then STDOUT should be: |
| 86 | + """ |
| 87 | + inactive |
| 88 | + """ |
| 89 | + |
| 90 | + @require-wp-6.5 |
| 91 | + Scenario: Install dependencies with activation |
| 92 | + Given a WP install |
| 93 | + |
| 94 | + # Create a test plugin with dependencies |
| 95 | + And a wp-content/plugins/test-plugin/test-plugin.php file: |
| 96 | + """ |
| 97 | + <?php |
| 98 | + /** |
| 99 | + * Plugin Name: Test Plugin |
| 100 | + * Requires Plugins: akismet, buddypress |
| 101 | + */ |
| 102 | + """ |
| 103 | + |
| 104 | + When I try `wp plugin install-dependencies test-plugin --activate` |
| 105 | + Then STDOUT should contain: |
| 106 | + """ |
| 107 | + Installing 2 dependencies for 'test-plugin' |
| 108 | + """ |
| 109 | + And STDOUT should contain: |
| 110 | + """ |
| 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. |
| 120 | + """ |
| 121 | + |
| 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: |
| 161 | + """ |
| 162 | + Success: Installed 1 of 1 plugins. |
| 163 | + """ |
| 164 | + And STDERR should be empty |
| 165 | + |
| 166 | + @require-wp-6.5 |
| 167 | + Scenario: Install plugin with no dependencies |
| 168 | + Given a WP install |
| 169 | + |
| 170 | + And a wp-content/plugins/test-plugin/test-plugin.php file: |
| 171 | + """ |
| 172 | + <?php |
| 173 | + /** |
| 174 | + * Plugin Name: Test Plugin No Deps |
| 175 | + */ |
| 176 | + """ |
| 177 | + |
| 178 | + When I run `wp plugin install-dependencies test-plugin` |
| 179 | + Then STDOUT should contain: |
| 180 | + """ |
| 181 | + Success: Plugin 'test-plugin' has no dependencies. |
| 182 | + """ |
| 183 | + |
| 184 | + @require-wp-6.5 |
| 185 | + Scenario: Error when installing dependencies of non-existent plugin |
| 186 | + Given a WP install |
| 187 | + |
| 188 | + When I try `wp plugin install-dependencies non-existent-plugin` |
| 189 | + Then STDERR should contain: |
| 190 | + """ |
| 191 | + Error: The 'non-existent-plugin' plugin could not be found. |
| 192 | + """ |
| 193 | + And the return code should be 1 |
0 commit comments