Skip to content

Commit c13bbd5

Browse files
Copilotswissspidy
andcommitted
Update tests to exercise the actual fix
Replace --force tests with tests that actually exercise the code path where activate_plugin() returns 'plugin_already_active'. These tests verify that installing an already-active plugin with --activate (without --force) correctly treats the 'plugin_already_active' error as success. Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 1b639da commit c13bbd5

1 file changed

Lines changed: 18 additions & 10 deletions

File tree

features/plugin-install.feature

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ Feature: Install WordPress plugins
306306
active
307307
"""
308308

309-
Scenario: Force update an active plugin with --activate flag should keep it activated
309+
Scenario: Install with --activate on already-active plugin should keep it activated
310310
Given a WP install
311311

312312
When I run `wp plugin install hello-dolly --activate`
@@ -322,14 +322,18 @@ Feature: Install WordPress plugins
322322
active
323323
"""
324324

325-
When I run `wp plugin install hello-dolly --force --activate`
326-
Then STDOUT should contain:
325+
When I try `wp plugin install hello-dolly --activate`
326+
Then STDERR should contain:
327+
"""
328+
Warning: hello-dolly: Plugin already installed.
327329
"""
328-
Plugin updated successfully
330+
And STDOUT should contain:
331+
"""
332+
Activating 'hello-dolly'...
329333
"""
330334
And STDOUT should contain:
331335
"""
332-
Success: Installed 1 of 1 plugins.
336+
Plugin 'hello-dolly' activated.
333337
"""
334338
And the return code should be 0
335339

@@ -339,7 +343,7 @@ Feature: Install WordPress plugins
339343
active
340344
"""
341345

342-
Scenario: Force update a network-active plugin with --activate-network flag should keep it network-activated
346+
Scenario: Install with --activate-network on already-network-active plugin should keep it activated
343347
Given a WP multisite install
344348

345349
When I run `wp plugin install hello-dolly --activate-network`
@@ -355,14 +359,18 @@ Feature: Install WordPress plugins
355359
active-network
356360
"""
357361

358-
When I run `wp plugin install hello-dolly --force --activate-network`
359-
Then STDOUT should contain:
362+
When I try `wp plugin install hello-dolly --activate-network`
363+
Then STDERR should contain:
364+
"""
365+
Warning: hello-dolly: Plugin already installed.
360366
"""
361-
Plugin updated successfully
367+
And STDOUT should contain:
368+
"""
369+
Network-activating 'hello-dolly'...
362370
"""
363371
And STDOUT should contain:
364372
"""
365-
Success: Installed 1 of 1 plugins.
373+
Plugin 'hello-dolly' network activated.
366374
"""
367375
And the return code should be 0
368376

0 commit comments

Comments
 (0)