Skip to content

Commit 5b4b9e8

Browse files
Copilotswissspidy
andcommitted
Fix failing tests - correct expected output and use zip for install test
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent 468010a commit 5b4b9e8

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

features/plugin-activate.feature

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,15 @@ Feature: Activate WordPress plugins
206206

207207
# Try activating without --force (should skip)
208208
When I try `wp plugin activate force-test`
209-
Then STDERR should be:
209+
Then STDERR should contain:
210210
"""
211211
Warning: Plugin 'force-test' is already active.
212-
Error: No plugins activated.
213212
"""
213+
And STDOUT should be:
214+
"""
215+
Success: Plugin already activated.
216+
"""
217+
And the return code should be 0
214218
And the wp-content/activation-test.txt file should not exist
215219

216220
# Now try with --force (should re-run activation hooks)

features/plugin-install.feature

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ Feature: Install WordPress plugins
308308

309309
Scenario: Force reinstall and activate an already active plugin to re-run activation hooks
310310
Given a WP install
311-
And a wp-content/plugins/install-force-test.php file:
311+
And a wp-content/plugins/install-force-test/install-force-test.php file:
312312
"""
313313
<?php
314314
/**
@@ -333,11 +333,14 @@ Feature: Install WordPress plugins
333333
# Remove the file to test if it gets recreated with --force
334334
When I run `rm wp-content/install-activation-test.txt`
335335

336+
# Create a zip of the plugin for reinstallation
337+
When I run `cd wp-content/plugins && zip -r /tmp/install-force-test.zip install-force-test`
338+
336339
# Try install --activate without --force (should skip activation hooks)
337-
When I run `wp plugin install install-force-test --activate`
340+
When I run `wp plugin install /tmp/install-force-test.zip --activate`
338341
Then STDOUT should contain:
339342
"""
340-
Plugin already installed.
343+
Unpacking the package...
341344
"""
342345
And STDOUT should contain:
343346
"""
@@ -350,7 +353,7 @@ Feature: Install WordPress plugins
350353
And the wp-content/install-activation-test.txt file should not exist
351354

352355
# Now try install --activate --force (should re-run activation hooks)
353-
When I run `wp plugin install install-force-test --activate --force`
356+
When I run `wp plugin install /tmp/install-force-test.zip --activate --force`
354357
Then STDOUT should contain:
355358
"""
356359
Activating 'install-force-test'...

0 commit comments

Comments
 (0)