-
Notifications
You must be signed in to change notification settings - Fork 85
Add check-update commands for plugins and themes #475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
14
commits into
main
Choose a base branch
from
copilot/add-plugin-theme-language-update-check
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e6f3051
Initial plan
Copilot cd83498
Add check-update commands for plugins and themes
Copilot da431b3
Fix trailing whitespace in check-update methods
Copilot 0f4b688
Add @subcommand check-update annotations
Copilot 68cb95c
Fix tests
swissspidy 7c89401
PHPStan fix
swissspidy 5102cce
Force install theme
swissspidy 50d893a
Fix more tests
swissspidy 6ec045c
Merge branch 'main' into copilot/add-plugin-theme-language-update-check
swissspidy 4a09071
Merge branch 'main' into copilot/add-plugin-theme-language-update-check
swissspidy 6a204af
Update src/Plugin_Command.php
swissspidy 2b58da7
Validate plugin/theme names using filter_item_list
Copilot 696bc8c
Merge branch 'main' into copilot/add-plugin-theme-language-update-check
swissspidy 6a924f0
Use fetcher->get_many for validation instead of filter_item_list
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| Feature: Check for plugin updates | ||
|
|
||
| @require-wp-5.2 | ||
| Scenario: Check for plugin updates with no updates available | ||
| Given a WP install | ||
|
|
||
| When I run `wp plugin install wordpress-importer --activate` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp plugin check-update --all` | ||
| Then STDOUT should contain: | ||
| """ | ||
| Success: All plugins are up to date. | ||
| """ | ||
|
|
||
| When I run `wp plugin check-update wordpress-importer` | ||
| Then STDOUT should contain: | ||
| """ | ||
| Success: All plugins are up to date. | ||
| """ | ||
|
|
||
| Scenario: Check for plugin updates should throw an error unless --all given | ||
| Given a WP install | ||
|
|
||
| When I try `wp plugin check-update` | ||
| Then the return code should be 1 | ||
| And STDERR should be: | ||
| """ | ||
| Error: Please specify one or more plugins, or use --all. | ||
| """ | ||
| And STDOUT should be empty | ||
|
|
||
| @require-wp-5.2 | ||
| Scenario: Check for specific plugin updates | ||
| Given a WP install | ||
|
|
||
| When I run `wp plugin install wordpress-importer --version=0.5` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp plugin check-update wordpress-importer --format=csv` | ||
| Then STDOUT should contain: | ||
| """ | ||
| wordpress-importer,inactive,0.5, | ||
| """ | ||
|
|
||
| @require-wp-5.2 | ||
| Scenario: Check for all plugin updates with --all flag | ||
| Given a WP install | ||
|
|
||
| When I run `wp plugin install wordpress-importer --version=0.5 --activate` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp plugin check-update --all --format=csv` | ||
| Then STDOUT should contain: | ||
| """ | ||
| wordpress-importer,active,0.5, | ||
| """ | ||
|
|
||
| @require-wp-5.2 | ||
| Scenario: Check for plugin updates in different output formats | ||
| Given a WP install | ||
|
|
||
| When I run `wp plugin install wordpress-importer --version=0.5` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp plugin check-update wordpress-importer --format=json` | ||
| Then STDOUT should be JSON containing: | ||
| """ | ||
| [{"name":"wordpress-importer","status":"inactive","version":"0.5"}] | ||
| """ | ||
|
|
||
| When I run `wp plugin check-update wordpress-importer --format=csv` | ||
| Then STDOUT should contain: | ||
| """ | ||
| name,status,version,update_version | ||
| """ | ||
| And STDOUT should contain: | ||
| """ | ||
| wordpress-importer,inactive,0.5 | ||
swissspidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
|
|
||
| @require-wp-5.2 | ||
| Scenario: Check for plugin updates with custom fields | ||
| Given a WP install | ||
|
|
||
| When I run `wp plugin install wordpress-importer --version=0.5` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp plugin check-update wordpress-importer --fields=name,version` | ||
| Then STDOUT should be a table containing rows: | ||
| | name | version | | ||
| | wordpress-importer | 0.5 | | ||
|
|
||
| Scenario: Check for invalid plugin should error | ||
| Given a WP install | ||
|
|
||
| When I try `wp plugin check-update invalid-plugin-name` | ||
| Then the return code should be 1 | ||
| And STDERR should contain: | ||
| """ | ||
| Error: | ||
| """ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| Feature: Check for theme updates | ||
|
|
||
| Scenario: Check for theme updates with no updates available | ||
| Given a WP install | ||
|
|
||
| When I run `wp theme install twentytwelve --force` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp theme check-update --all` | ||
| Then STDOUT should contain: | ||
| """ | ||
| Success: All themes are up to date. | ||
| """ | ||
|
|
||
| When I run `wp theme check-update twentytwelve` | ||
| Then STDOUT should contain: | ||
| """ | ||
| Success: All themes are up to date. | ||
| """ | ||
|
|
||
| Scenario: Check for theme updates should throw an error unless --all given | ||
| Given a WP install | ||
|
|
||
| When I try `wp theme check-update` | ||
| Then the return code should be 1 | ||
| And STDERR should be: | ||
| """ | ||
| Error: Please specify one or more themes, or use --all. | ||
| """ | ||
| And STDOUT should be empty | ||
|
|
||
| Scenario: Check for specific theme updates | ||
| Given a WP install | ||
|
|
||
| When I run `wp theme install twentyfourteen --version=1.0 --force` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp theme install twentytwelve --force` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp theme check-update twentyfourteen --format=csv` | ||
| Then STDOUT should contain: | ||
| """ | ||
| twentyfourteen,inactive,1.0, | ||
| """ | ||
|
|
||
| Scenario: Check for all theme updates with --all flag | ||
| Given a WP install | ||
|
|
||
| When I run `wp theme install twentyfourteen --version=1.0 --force` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp theme check-update --all --format=csv` | ||
| Then STDOUT should contain: | ||
| """ | ||
| twentyfourteen,inactive,1.0, | ||
| """ | ||
|
|
||
| Scenario: Check for theme updates in different output formats | ||
| Given a WP install | ||
|
|
||
| When I run `wp theme install twentyfourteen --version=1.0 --force` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp theme check-update twentyfourteen --format=json` | ||
| Then STDOUT should be JSON containing: | ||
| """ | ||
| [{"name":"twentyfourteen","status":"inactive","version":"1.0"}] | ||
| """ | ||
swissspidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| When I run `wp theme check-update twentyfourteen --format=csv` | ||
| Then STDOUT should contain: | ||
| """ | ||
| name,status,version,update_version | ||
| """ | ||
| And STDOUT should contain: | ||
| """ | ||
| twentyfourteen,inactive,1.0 | ||
swissspidy marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| """ | ||
|
|
||
| Scenario: Check for theme updates with custom fields | ||
| Given a WP install | ||
|
|
||
| When I run `wp theme install twentyfourteen --version=1.0 --force` | ||
| Then STDOUT should not be empty | ||
|
|
||
| When I run `wp theme check-update twentyfourteen --fields=name,version` | ||
| Then STDOUT should be a table containing rows: | ||
| | name | version | | ||
| | twentyfourteen | 1.0 | | ||
|
|
||
| Scenario: Check for invalid theme should error | ||
| Given a WP install | ||
|
|
||
| When I try `wp theme check-update invalid-theme-name` | ||
| Then the return code should be 1 | ||
| And STDERR should contain: | ||
| """ | ||
| Error: | ||
| """ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.