Skip to content

Commit

Permalink
Merge branch 'main' into feature/plugin-theme-force-check-183
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy authored Jan 31, 2025
2 parents 9c85840 + f0cebef commit 069bbb5
Show file tree
Hide file tree
Showing 16 changed files with 285 additions and 37 deletions.
1 change: 1 addition & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Testing

on:
workflow_dispatch:
pull_request:
push:
branches:
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ These fields are optionally available:
Installs one or more plugins.

~~~
wp plugin install <plugin|zip|url>... [--version=<version>] [--force] [--activate] [--activate-network] [--insecure]
wp plugin install <plugin|zip|url>... [--version=<version>] [--force] [--ignore-requirements] [--activate] [--activate-network] [--insecure]
~~~

**OPTIONS**
Expand All @@ -255,6 +255,10 @@ wp plugin install <plugin|zip|url>... [--version=<version>] [--force] [--activat
If set, the command will overwrite any installed version of the plugin, without prompting
for confirmation.

[--ignore-requirements]
:If set, the command will install the plugin while ignoring any WordPress or PHP version requirements
specified by the plugin authors.

[--activate]
If set, the plugin will be activated immediately after install.

Expand Down Expand Up @@ -993,7 +997,7 @@ wp theme get <theme> [--field=<field>] [--fields=<fields>] [--format=<format>]
Installs one or more themes.

~~~
wp theme install <theme|zip|url>... [--version=<version>] [--force] [--activate] [--insecure]
wp theme install <theme|zip|url>... [--version=<version>] [--force] [--ignore-requirements] [--activate] [--insecure]
~~~

**OPTIONS**
Expand All @@ -1009,6 +1013,10 @@ wp theme install <theme|zip|url>... [--version=<version>] [--force] [--activate]
If set, the command will overwrite any installed version of the theme, without prompting
for confirmation.

[--ignore-requirements]
If set, the command will install the theme while ignoring any WordPress or PHP version requirements
specified by the theme authors.

[--activate]
If set, the theme will be activated immediately after install.

Expand Down
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
],
"require": {
"composer/semver": "^1.4 || ^2 || ^3",
"wp-cli/wp-cli": "^2.10"
"wp-cli/wp-cli": "^2.12"
},
"require-dev": {
"wp-cli/cache-command": "^2.0",
Expand All @@ -33,7 +33,8 @@
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true,
"johnpbloch/wordpress-core-installer": true
}
},
"lock": false
},
"extra": {
"branch-alias": {
Expand Down
8 changes: 4 additions & 4 deletions features/plugin-activate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ Feature: Activate WordPress plugins
And the return code should be 0

Scenario: Attempt to activate a plugin that's not installed
When I try `wp plugin activate edit-flow`
When I try `wp plugin activate debug-bar`
Then STDERR should be:
"""
Warning: The 'edit-flow' plugin could not be found.
Warning: The 'debug-bar' plugin could not be found.
Error: No plugins activated.
"""
And the return code should be 1

When I try `wp plugin activate akismet hello edit-flow`
When I try `wp plugin activate akismet hello debug-bar`
Then STDERR should be:
"""
Warning: The 'edit-flow' plugin could not be found.
Warning: The 'debug-bar' plugin could not be found.
Error: Only activated 2 of 3 plugins.
"""
And STDOUT should be:
Expand Down
2 changes: 1 addition & 1 deletion features/plugin-auto-updates-disable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Disable auto-updates for WordPress plugins

Background:
Given a WP install
And I run `wp plugin install duplicate-post`
And I run `wp plugin install duplicate-post --ignore-requirements`
And I run `wp plugin auto-updates enable --all`

@require-wp-5.5
Expand Down
2 changes: 1 addition & 1 deletion features/plugin-auto-updates-enable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Enable auto-updates for WordPress plugins

Background:
Given a WP install
And I run `wp plugin install duplicate-post`
And I run `wp plugin install duplicate-post --ignore-requirements`

@require-wp-5.5
Scenario: Show an error if required params are missing
Expand Down
2 changes: 1 addition & 1 deletion features/plugin-auto-updates-status.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Feature: Show the status of auto-updates for WordPress plugins

Background:
Given a WP install
And I run `wp plugin install duplicate-post`
And I run `wp plugin install duplicate-post --ignore-requirements`

@require-wp-5.5
Scenario: Show an error if required params are missing
Expand Down
8 changes: 4 additions & 4 deletions features/plugin-deactivate.feature
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ Feature: Deactivate WordPress plugins
And the return code should be 0

Scenario: Attempt to deactivate a plugin that's not installed
When I try `wp plugin deactivate edit-flow`
When I try `wp plugin deactivate debug-bar`
Then STDERR should be:
"""
Warning: The 'edit-flow' plugin could not be found.
Warning: The 'debug-bar' plugin could not be found.
Error: No plugins deactivated.
"""
And STDOUT should be empty
And the return code should be 1

When I try `wp plugin deactivate akismet hello edit-flow`
When I try `wp plugin deactivate akismet hello debug-bar`
Then STDERR should be:
"""
Warning: The 'edit-flow' plugin could not be found.
Warning: The 'debug-bar' plugin could not be found.
Error: Only deactivated 2 of 3 plugins.
"""
And STDOUT should be:
Expand Down
4 changes: 2 additions & 2 deletions features/plugin-delete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Feature: Delete WordPress plugins
"""

Scenario: Attempting to delete a plugin that doesn't exist
When I try `wp plugin delete edit-flow`
When I try `wp plugin delete debug-bar`
Then STDOUT should be:
"""
Success: Plugin already deleted.
"""
And STDERR should be:
"""
Warning: The 'edit-flow' plugin could not be found.
Warning: The 'debug-bar' plugin could not be found.
"""
And the return code should be 0

Expand Down
41 changes: 37 additions & 4 deletions features/plugin-install.feature
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,10 @@ Feature: Install WordPress plugins
define( 'WP_PROXY_PORT', '443' );
"""

When I try `wp --require=invalid-proxy-details.php plugin install edit-flow`
When I try `wp --require=invalid-proxy-details.php plugin install debug-bar`
Then STDERR should contain:
"""
Warning: edit-flow: An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration.
Warning: debug-bar: An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration.
"""
And STDERR should contain:
"""
Expand All @@ -104,7 +104,7 @@ Feature: Install WordPress plugins
And STDOUT should be empty
And the return code should be 1

When I run `wp plugin install edit-flow`
When I run `wp plugin install debug-bar`
Then STDOUT should contain:
"""
Plugin installed successfully.
Expand Down Expand Up @@ -171,7 +171,7 @@ Feature: Install WordPress plugins
When I run `rm wp-content/plugins/akismet/akismet.php`
Then the return code should be 0

When I try `wp plugin install akismet`
When I try `wp plugin install akismet --ignore-requirements`
Then STDERR should contain:
"""
Warning: Destination folder already exists. "{WORKING_DIR}/wp-content/plugins/akismet/"
Expand Down Expand Up @@ -237,3 +237,36 @@ Feature: Install WordPress plugins
Plugin 'site-secrets' activated.
Success: Plugin already installed.
"""

@require-php-7
Scenario: Can't install plugin that requires a newer version of WordPress
Given a WP install

When I run `wp core download --version=6.4 --force`
And I run `rm -r wp-content/themes/*`

And I try `wp plugin install wp-super-cache`
Then STDERR should contain:
"""
Warning: wp-super-cache: This plugin does not work with your version of WordPress
"""

And STDERR should contain:
"""
Error: No plugins installed.
"""

@less-than-php-7.4 @require-wp-6.6
Scenario: Can't install plugin that requires a newer version of PHP
Given a WP install

And I try `wp plugin install contact-form-7`
Then STDERR should contain:
"""
Warning: contact-form-7: This plugin does not work with your version of PHP
"""

And STDERR should contain:
"""
Error: No plugins installed.
"""
8 changes: 4 additions & 4 deletions features/plugin-toggle.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ Feature: Toggle the activation status of a plugin
"""

Scenario: Toggling the status of a plugin that doesn't exist
When I try `wp plugin toggle akismet edit-flow`
When I try `wp plugin toggle akismet debug-bar`
Then STDERR should be:
"""
Warning: The 'edit-flow' plugin could not be found.
Warning: The 'debug-bar' plugin could not be found.
Error: Only toggled 1 of 2 plugins.
"""
And STDOUT should be:
Expand All @@ -31,10 +31,10 @@ Feature: Toggle the activation status of a plugin
"""
And the return code should be 1

When I try `wp plugin toggle edit-flow co-authors-plus`
When I try `wp plugin toggle debug-bar co-authors-plus`
Then STDERR should be:
"""
Warning: The 'edit-flow' plugin could not be found.
Warning: The 'debug-bar' plugin could not be found.
Warning: The 'co-authors-plus' plugin could not be found.
Error: No plugins toggled.
"""
Expand Down
Loading

0 comments on commit 069bbb5

Please sign in to comment.